Mercurial > hg > toybox
diff toys/other/ifconfig.c @ 1257:eb19245b94b6 draft
An issue in ifconfig while verifying the HW Address, which is assumed to be of the format __C2:79:38:95:CD:AB__ but can be of form __C2:79:38:95:D:A__. In this case the HW address is reported as bad.
author | Ashwini sharma <ak.ashwini1981@gmail.com> |
---|---|
date | Sun, 13 Apr 2014 16:04:16 -0500 |
parents | 1aa9b7f39e4a |
children | 00c20f410c46 |
line wrap: on
line diff
--- a/toys/other/ifconfig.c Sun Apr 13 15:58:20 2014 -0500 +++ b/toys/other/ifconfig.c Sun Apr 13 16:04:16 2014 -0500 @@ -415,7 +415,7 @@ if (*hw_addr == ':') hw_addr++; sscanf(hw_addr, "%2x%n", &val, &len); - if (len != 2) break; + if (!len || len > 2) break; // 1 nibble can be set e.g. C2:79:38:95:D:A hw_addr += len; *p++ = val; }