]> git.wh0rd.org - patches.git/blob - glibc-inet-network-0x.patch
initial import
[patches.git] / glibc-inet-network-0x.patch
1 2007-09-15 Mike Frysinger <vapier@gentoo.org>
2
3 * inet/inet_net.c: Reset digit to 0 for inputs starting with "0x".
4 * inet/tst-network.c (tests): Add edge case tests for "0", "0x", "0x0".
5
6 Index: inet/inet_net.c
7 ===================================================================
8 RCS file: /cvs/glibc/libc/inet/inet_net.c,v
9 retrieving revision 1.10
10 diff -u -p -r1.10 inet_net.c
11 --- inet/inet_net.c 12 Feb 2000 07:38:04 -0000 1.10
12 +++ inet/inet_net.c 15 Sep 2007 06:14:59 -0000
13 @@ -55,7 +55,7 @@ again:
14 if (*cp == '0')
15 digit = 1, base = 8, cp++;
16 if (*cp == 'x' || *cp == 'X')
17 - base = 16, cp++;
18 + digit = 0, base = 16, cp++;
19 while ((c = *cp) != 0) {
20 if (isdigit(c)) {
21 if (base == 8 && (c == '8' || c == '9'))
22 Index: inet/tst-network.c
23 ===================================================================
24 RCS file: /cvs/glibc/libc/inet/tst-network.c,v
25 retrieving revision 1.4
26 diff -u -p -r1.4 tst-network.c
27 --- inet/tst-network.c 15 Sep 2007 04:10:38 -0000 1.4
28 +++ inet/tst-network.c 15 Sep 2007 06:14:59 -0000
29 @@ -34,7 +34,10 @@ struct
30 {"1.0", 0x100},
31 {"1", 0x1},
32 {"192.168.0.0", 0xC0A80000},
33 + {"0", 0},
34 + {"0x0", 0},
35 /* Now some invalid addresses. */
36 + {"0x", INADDR_NONE},
37 {"141.30.225.2800", INADDR_NONE},
38 {"141.76.1.1.1", INADDR_NONE},
39 {"141.76.1.11.", INADDR_NONE},