]> granicus.if.org Git - curl/commitdiff
chunked decoder: track overflows correctly
authorDaniel Stenberg <daniel@haxx.se>
Wed, 12 Feb 2014 13:33:17 +0000 (14:33 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 12 Feb 2014 13:35:46 +0000 (14:35 +0100)
The code didn't properly check the return codes to detect overflows so
it could trigger incorrectly. Like on mingw32.

Regression introduced in 345891edba (curl 7.35.0)

Bug: http://curl.haxx.se/mail/lib-2014-02/0097.html
Reported-by: LM
lib/http_chunks.c

index 47de95845679b4af970fe19f30bcd14c5c3f3941..83e3f0eec25b98b93077d5a5d1249408569cd90c 100644 (file)
@@ -162,8 +162,8 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
         }
 
         ch->datasize=curlx_strtoofft(ch->hexbuffer, &endptr, 16);
-        if(errno == ERANGE)
-          /* over or underflow is an error */
+        if((ch->datasize == CURL_OFF_T_MAX) && (errno == ERANGE))
+          /* overflow is an error */
           return CHUNKE_ILLEGAL_HEX;
         ch->state = CHUNK_LF; /* now wait for the CRLF */
       }