net-tools/net-tools-1.60-ifconfig-long-iface-crasher.patch

37 lines
946 B
Diff
Raw Normal View History

2011-12-06 18:15:09 +00:00
diff -up net-tools-1.60/lib/interface.c.long_iface net-tools-1.60/lib/interface.c
--- net-tools-1.60/lib/interface.c.long_iface 2011-12-05 18:16:38.000000000 +0100
+++ net-tools-1.60/lib/interface.c 2011-12-05 19:13:17.343530194 +0100
@@ -216,6 +216,7 @@ out:
2011-12-06 18:15:09 +00:00
char *get_name(char **namep, char *p)
{
2011-12-06 18:15:09 +00:00
+ int count = 0;
while (isspace(*p))
p++;
2008-07-15 12:30:02 +00:00
char *name = *namep = p;
2011-12-06 18:15:09 +00:00
@@ -224,7 +225,13 @@ char *get_name(char **namep, char *p)
break;
if (*p == ':') { /* could be an alias */
2011-12-06 18:15:09 +00:00
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 @@ char *get_name(char **namep, char *p)
break;
}
*name++ = *p++;
+ count++;
+ if (count == (IFNAMSIZ-1))
+ break;
}
*name++ = '\0';
return p;