diff options
-rw-r--r-- | lib/util/util.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/util/util.c b/lib/util/util.c index b700f372c7..c5ed6fd0c7 100644 --- a/lib/util/util.c +++ b/lib/util/util.c @@ -712,13 +712,17 @@ _PUBLIC_ size_t strhex_to_str(char *p, size_t p_len, const char *strhex, size_t } for (; i < strhex_len && strhex[i] != 0; i++) { - if (!(p1 = strchr(hexchars, toupper((unsigned char)strhex[i])))) + p1 = strchr(hexchars, toupper((unsigned char)strhex[i])); + if (p1 == NULL) { break; + } i++; /* next hex digit */ - if (!(p2 = strchr(hexchars, toupper((unsigned char)strhex[i])))) + p2 = strchr(hexchars, toupper((unsigned char)strhex[i])); + if (p2 == NULL) { break; + } /* get the two nybbles */ hinybble = PTR_DIFF(p1, hexchars); |