From: Jaroslav Kysela Date: Fri, 3 Oct 2014 12:47:23 +0000 (+0200) Subject: http: handle negative value from base64_decode (coverity) X-Git-Tag: v4.1~1206 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7fc28acf56ca024feb76119bc53be4a767624c6e;p=thirdparty%2Ftvheadend.git http: handle negative value from base64_decode (coverity) --- diff --git a/src/http.c b/src/http.c index f59131746..dc9e741d1 100644 --- a/src/http.c +++ b/src/http.c @@ -638,6 +638,8 @@ process_request(http_connection_t *hc, htsbuf_queue_t *spill) if((v = http_arg_get(&hc->hc_args, "Authorization")) != NULL) { if((n = http_tokenize(v, argv, 2, -1)) == 2) { n = base64_decode(authbuf, argv[1], sizeof(authbuf) - 1); + if (n < 0) + n = 0; authbuf[n] = 0; if((n = http_tokenize((char *)authbuf, argv, 2, ':')) == 2) { hc->hc_username = strdup(argv[0]);