Hi,
Steve has modified a while ago hex_str_to_bytes to handle Cisco MAC
format (xxxx.xxxx.xxxx). It did not test the nullity of the third and
fourth byte (*r, *s) which is however done for the second byte. The test
on the second byte is done as well in the following conditional tests.
If this test is not mandatory thanks to the return value of isxdigit (at
least on GNU/Linux and guess it should be the same on any platform), it
would be better to follow the same logic in all tests cases for the
comprehension of everyone (... which /could/ even, with luck, be turned
in a faster code).
Here is a light patch to follow the logic of the conditional tests done
in the function.
Regards,
Sebastien Tandel
Index: epan/strutil.c
===================================================================
--- epan/strutil.c (révision 20702)
+++ epan/strutil.c (copie de travail)
@@ -443,7 +443,8 @@
r = p+2;
s = p+3;
- if (*q && isxdigit(*p) && isxdigit(*q) &&
+ if (*q && *r && *s
+ && isxdigit(*p) && isxdigit(*q) &&
isxdigit(*r) && isxdigit(*s)) {
four_digits_first_half[0] = *p;
four_digits_first_half[1] = *q;