diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-10-16 13:03:52 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-10-16 20:04:28 +0000 |
commit | 71a42e0fbcc8ac838f936dd88e05681ef07f2bbf (patch) | |
tree | f750f2d44803af236a01be636977c10b4d378636 /epan/strutil.c | |
parent | f6bc6f957a13471fecb4ce0a31ca09f30cdde44f (diff) |
Oops, I missed one "cast a char to int and use it as a subscript" case.
Casting a signed char with a negative value to int will preserve the
value, so it'll still be a negative subscript. Cast to guchar instead,
to make sure 0x80 through 0xFF are treated as 128 to 255, not -128 to
-1.
Change-Id: I1f0b33ba3686e963d45317b45465ff335431d17f
Reviewed-on: https://code.wireshark.org/review/4742
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/strutil.c')
-rw-r--r-- | epan/strutil.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/epan/strutil.c b/epan/strutil.c index 148eaf417c..de52320568 100644 --- a/epan/strutil.c +++ b/epan/strutil.c @@ -647,7 +647,7 @@ hex_str_to_bytes_encoding(const gchar *hex_str, GByteArray *bytes, const gchar * ++end; /* check for separator and peek at next char to make sure we should keep going */ - if (sep > 0 && *end == sep && str_to_nibble[(int)*(end+1)] > -1) { + if (sep > 0 && *end == sep && str_to_nibble[(guchar)*(end+1)] > -1) { /* yes, it's the right sep and followed by more hex, so skip the sep */ ++end; } else if (sep != 0 && *end) { |