aboutsummaryrefslogtreecommitdiffstats
path: root/epan/strutil.c
diff options
context:
space:
mode:
authorStephen Fisher <steve@stephen-fisher.com>2007-02-04 19:23:10 +0000
committerStephen Fisher <steve@stephen-fisher.com>2007-02-04 19:23:10 +0000
commitc12d1c7c5b73b3d71392ace16085a9ba9cbf1710 (patch)
treece5c4bdec149d900f7497d3fe95634949dbbdb10 /epan/strutil.c
parent6c56afbed473eb7f9ce924c1de0bf36d3241dd52 (diff)
From Sebastien Tandel:
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. svn path=/trunk/; revision=20714
Diffstat (limited to 'epan/strutil.c')
-rw-r--r--epan/strutil.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/epan/strutil.c b/epan/strutil.c
index 94399ba1c9..365b4e5594 100644
--- a/epan/strutil.c
+++ b/epan/strutil.c
@@ -443,7 +443,8 @@ hex_str_to_bytes(const char *hex_str, GByteArray *bytes, gboolean force_separato
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;