aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBernd Eckenfels <net-tools@lina.inka.de>2002-06-14 01:33:50 +0000
committerBernd Eckenfels <net-tools@lina.inka.de>2002-06-14 01:33:50 +0000
commit2c3f73f896b172066623ce9cca23e909b501b41c (patch)
treeaa29c13f0766713881534aa4b82f1a5c5363f725 /lib
parentthis fixes segfault on -A "" and -F "" in mii-tool reported in debian (diff)
downloadnet-tools-2c3f73f896b172066623ce9cca23e909b501b41c.tar.gz
net-tools-2c3f73f896b172066623ce9cca23e909b501b41c.tar.bz2
net-tools-2c3f73f896b172066623ce9cca23e909b501b41c.zip
thanks to "Erik A. Hendriks" <hendriks@lanl.gov> the interface nane
bug in debian (#135744) is fixed, with his patch in (#149579) hopefully.
Diffstat (limited to 'lib')
-rw-r--r--lib/interface.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/lib/interface.c b/lib/interface.c
index ad268ae..aa7e91c 100644
--- a/lib/interface.c
+++ b/lib/interface.c
@@ -7,7 +7,7 @@
8/2000 Andi Kleen make the list operations a bit more efficient.
People are crazy enough to use thousands of aliases now.
- $Id: interface.c,v 1.23 2002/03/05 00:47:36 ecki Exp $
+ $Id: interface.c,v 1.24 2002/06/14 01:33:50 ecki Exp $
*/
#include "config.h"
@@ -210,16 +210,19 @@ char *get_name(char *name, char *p)
if (isspace(*p))
break;
if (*p == ':') { /* could be an alias */
- char *dot = p, *dotname = name;
- *name++ = *p++;
- while (isdigit(*p))
- *name++ = *p++;
- if (*p != ':') { /* it wasn't, backup */
- p = dot;
- name = dotname;
+ char *dot = p++;
+ while (*p && isdigit(*p)) p++;
+ if (*p == ':') {
+ /* Yes it is, backup and copy it. */
+ p = dot;
+ *name++ = *p++;
+ while (*p && isdigit(*p)) {
+ *name++ = *p++;
+ }
+ } else {
+ /* No, it isn't */
+ p = dot;
}
- if (*p == '\0')
- return NULL;
p++;
break;
}