]> git.ipfire.org Git - ipfire-3.x.git/blob - net-tools/patches/009-net-tools-ifconfig-long-iface-crasher.patch
git: Update to 2.23.0
[ipfire-3.x.git] / net-tools / patches / 009-net-tools-ifconfig-long-iface-crasher.patch
1 diff -up net-tools-2.0/lib/interface.c.long_iface net-tools-2.0/lib/interface.c
2 --- net-tools-2.0/lib/interface.c.long_iface 2014-11-24 15:09:45.130254503 +0100
3 +++ net-tools-2.0/lib/interface.c 2014-11-24 15:10:54.662270496 +0100
4 @@ -216,6 +216,7 @@ out:
5
6 static const char *get_name(char **namep, const char *p)
7 {
8 + int count = 0;
9 while (isspace(*p))
10 p++;
11 char *name = *namep = p;
12 @@ -224,7 +225,13 @@ static const char *get_name(char **namep
13 break;
14 if (*p == ':') { /* could be an alias */
15 const char *dot = p++;
16 - while (*p && isdigit(*p)) p++;
17 + count++;
18 + while (*p && isdigit(*p)) {
19 + p++;
20 + count++;
21 + if (count == (IFNAMSIZ-1))
22 + break;
23 + }
24 if (*p == ':') {
25 /* Yes it is, backup and copy it. */
26 p = dot;
27 @@ -240,6 +247,9 @@ static const char *get_name(char **namep
28 break;
29 }
30 *name++ = *p++;
31 + count++;
32 + if (count == (IFNAMSIZ-1))
33 + break;
34 }
35 *name++ = '\0';
36 return p;