}
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);