net-tools/net-tools-ifconfig-long-iface-crasher.patch
2014-11-24 15:15:01 +01:00

37 lines
973 B
Diff

diff -up net-tools-2.0/lib/interface.c.long_iface net-tools-2.0/lib/interface.c
--- net-tools-2.0/lib/interface.c.long_iface 2014-11-24 15:09:45.130254503 +0100
+++ net-tools-2.0/lib/interface.c 2014-11-24 15:10:54.662270496 +0100
@@ -216,6 +216,7 @@ out:
static const char *get_name(char **namep, const char *p)
{
+ int count = 0;
while (isspace(*p))
p++;
char *name = *namep = p;
@@ -224,7 +225,13 @@ static const char *get_name(char **namep
break;
if (*p == ':') { /* could be an alias */
const char *dot = p++;
- while (*p && isdigit(*p)) p++;
+ count++;
+ while (*p && isdigit(*p)) {
+ p++;
+ count++;
+ if (count == (IFNAMSIZ-1))
+ break;
+ }
if (*p == ':') {
/* Yes it is, backup and copy it. */
p = dot;
@@ -240,6 +247,9 @@ static const char *get_name(char **namep
break;
}
*name++ = *p++;
+ count++;
+ if (count == (IFNAMSIZ-1))
+ break;
}
*name++ = '\0';
return p;