~ubuntu-branches/ubuntu/breezy/koffice/breezy-security

« back to all changes in this revision

Viewing changes to kexi/3rdparty/uuid/parse.c

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2005-10-11 14:49:50 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051011144950-lwpngbifzp8nk0ds
Tags: 1:1.4.1-0ubuntu7
* SECURITY UPDATE: fix heap based buffer overflow in the RTF importer of KWord
* Opening specially crafted RTF files in KWord can cause
  execution of abitrary code.
* Add kubuntu_01_rtfimport_heap_overflow.diff
* References:
  CAN-2005-2971
  CESA-2005-005
  http://www.koffice.org/security/advisory-20051011-1.txt

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * parse.c --- UUID parsing
 
3
 * 
 
4
 * Copyright (C) 1996, 1997 Theodore Ts'o.
 
5
 *
 
6
 * %Begin-Header%
 
7
 * This file may be redistributed under the terms of the GNU 
 
8
 * Library General Public License.
 
9
 * %End-Header%
 
10
 */
 
11
 
 
12
#include <stdlib.h>
 
13
#include <stdio.h>
 
14
#include <ctype.h>
 
15
#include <string.h>
 
16
 
 
17
#include "uuidP.h"
 
18
 
 
19
int uuid_parse(const char *in, uuid_t uu)
 
20
{
 
21
        struct uuid     uuid;
 
22
        int             i;
 
23
        const char      *cp;
 
24
        char            buf[3];
 
25
 
 
26
        if (strlen(in) != 36)
 
27
                return -1;
 
28
        for (i=0, cp = in; i <= 36; i++,cp++) {
 
29
                if ((i == 8) || (i == 13) || (i == 18) ||
 
30
                    (i == 23)) {
 
31
                        if (*cp == '-')
 
32
                                continue;
 
33
                        else
 
34
                                return -1;
 
35
                }
 
36
                if (i== 36)
 
37
                        if (*cp == 0)
 
38
                                continue;
 
39
                if (!isxdigit(*cp))
 
40
                        return -1;
 
41
        }
 
42
        uuid.time_low = strtoul(in, NULL, 16);
 
43
        uuid.time_mid = strtoul(in+9, NULL, 16);
 
44
        uuid.time_hi_and_version = strtoul(in+14, NULL, 16);
 
45
        uuid.clock_seq = strtoul(in+19, NULL, 16);
 
46
        cp = in+24;
 
47
        buf[2] = 0;
 
48
        for (i=0; i < 6; i++) {
 
49
                buf[0] = *cp++;
 
50
                buf[1] = *cp++;
 
51
                uuid.node[i] = strtoul(buf, NULL, 16);
 
52
        }
 
53
        
 
54
        uuid_pack(&uuid, uu);
 
55
        return 0;
 
56
}