diff options
Diffstat (limited to 'apps/s_client.c')
-rw-r--r-- | apps/s_client.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/apps/s_client.c b/apps/s_client.c index fada838b68..d8d55014d7 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -518,19 +518,16 @@ static ossl_ssize_t hexdecode(const char **inptr, void *result) return -1; for (byte = 0; *in; ++in) { - char c; + int x; if (isspace(_UC(*in))) continue; - c = tolower(_UC(*in)); - if ('0' <= c && c <= '9') { - byte |= c - '0'; - } else if ('a' <= c && c <= 'f') { - byte |= c - 'a' + 10; - } else { + x = OPENSSL_hexchar2int(*in); + if (x < 0) { OPENSSL_free(ret); return 0; } + byte |= (char)x; if ((nibble ^= 1) == 0) { *cp++ = byte; byte = 0; |