jpopelka / rpms / net-tools

Forked from rpms/net-tools 4 years ago
Clone

Blame SOURCES/net-tools-ifconfig-long-iface-crasher.patch

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