Mercurial > hg > toybox
comparison 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 |
comparison
equal
deleted
inserted
replaced
1256:2fe64bc16a61 | 1257:eb19245b94b6 |
---|---|
413 while (*hw_addr && (p-ptr) < count) { | 413 while (*hw_addr && (p-ptr) < count) { |
414 int val, len = 0; | 414 int val, len = 0; |
415 | 415 |
416 if (*hw_addr == ':') hw_addr++; | 416 if (*hw_addr == ':') hw_addr++; |
417 sscanf(hw_addr, "%2x%n", &val, &len); | 417 sscanf(hw_addr, "%2x%n", &val, &len); |
418 if (len != 2) break; | 418 if (!len || len > 2) break; // 1 nibble can be set e.g. C2:79:38:95:D:A |
419 hw_addr += len; | 419 hw_addr += len; |
420 *p++ = val; | 420 *p++ = val; |
421 } | 421 } |
422 | 422 |
423 if ((p-ptr) != count || *hw_addr) | 423 if ((p-ptr) != count || *hw_addr) |