Commit 931ead58 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Slight polish

parent 4c814318
......@@ -109,7 +109,7 @@ hex_decode(const enum encoding dec, char *restrict const buf,
char *dest = buf;
const char *b;
unsigned char extranib = 0;
ssize_t len = 0;
size_t len = 0;
AN(buf);
AN(strings);
......@@ -123,25 +123,19 @@ hex_decode(const enum encoding dec, char *restrict const buf,
b = s;
while (*s) {
if (!isxdigit(*s++)) {
len = -1;
break;
errno = EINVAL;
return (-1);
}
}
if (len == -1)
break;
len += s - b;
}
if (len == 0)
return 0;
if (len == -1) {
errno = EINVAL;
return -1;
}
if (n != -1 && len > n)
len = n;
if ((len+1) >> 1 > buflen) {
if (((len+1) >> 1) > buflen) {
errno = ENOMEM;
return -1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment