idiotbox

youtube scraping and interfaces: CGI, Gopher, CLI
Log | Files | Refs | README | LICENSE

commit 24fec82df8a92ba13785ab85905535400eeac2b3
parent 86ab4376ce26a5addef4ddb0efb0ffb95b03316c
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun, 30 Dec 2018 13:49:37 +0100

fix UB

Diffstat:
Mcli.c | 3++-
Mgph.c | 3++-
Mmain.c | 3++-
Myoutube.c | 3++-
4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/cli.c b/cli.c @@ -66,7 +66,8 @@ decodeparam(char *buf, size_t bufsiz, const char *s) return -1; switch (*s) { case '%': - if (!isxdigit(*(s+1)) || !isxdigit(*(s+2))) + if (!isxdigit((unsigned char)*(s+1)) || + !isxdigit((unsigned char)*(s+2))) return -1; buf[i++] = hexdigit(*(s+1)) * 16 + hexdigit(*(s+2)); s += 2; diff --git a/gph.c b/gph.c @@ -66,7 +66,8 @@ decodeparam(char *buf, size_t bufsiz, const char *s) return -1; switch (*s) { case '%': - if (!isxdigit(*(s+1)) || !isxdigit(*(s+2))) + if (!isxdigit((unsigned char)*(s+1)) || + !isxdigit((unsigned char)*(s+2))) return -1; buf[i++] = hexdigit(*(s+1)) * 16 + hexdigit(*(s+2)); s += 2; diff --git a/main.c b/main.c @@ -71,7 +71,8 @@ decodeparam(char *buf, size_t bufsiz, const char *s) return -1; switch (*s) { case '%': - if (!isxdigit(*(s+1)) || !isxdigit(*(s+2))) + if (!isxdigit((unsigned char)*(s+1)) || + !isxdigit((unsigned char)*(s+2))) return -1; buf[i++] = hexdigit(*(s+1)) * 16 + hexdigit(*(s+2)); s += 2; diff --git a/youtube.c b/youtube.c @@ -81,7 +81,8 @@ decodeparam(char *buf, size_t bufsiz, const char *s) return -1; switch (*s) { case '%': - if (!isxdigit(*(s+1)) || !isxdigit(*(s+2))) + if (!isxdigit((unsigned char)*(s+1)) || + !isxdigit((unsigned char)*(s+2))) return -1; buf[i++] = hexdigit(*(s+1)) * 16 + hexdigit(*(s+2)); s += 2;