aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2001-03-12 15:20:35 +0000
committerDaniel Stenberg <daniel@haxx.se>2001-03-12 15:20:35 +0000
commitd95fa648e9da36386c452c624b080bb97cf7c4b4 (patch)
treeb7f9a6572e2d4945d96624f9cf3aa8b60d83fcd3 /lib
parent563ad213dc6854eb5a57f390a8e1bbbecc4088e3 (diff)
made it return illegal hex in case no hexadecimal digit was read when at
least one was expected
Diffstat (limited to 'lib')
-rw-r--r--lib/http_chunks.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/http_chunks.c b/lib/http_chunks.c
index bbc208e21..c11003354 100644
--- a/lib/http_chunks.c
+++ b/lib/http_chunks.c
@@ -115,10 +115,15 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
ch->hexindex++;
}
else {
- return 1; /* longer hex than we support */
+ return CHUNKE_TOO_LONG_HEX; /* longer hex than we support */
}
}
else {
+ if(0 == ch->hexindex) {
+ /* This is illegal data, we received junk where we expected
+ a hexadecimal digit. */
+ return CHUNKE_ILLEGAL_HEX;
+ }
/* length and datap are unmodified */
ch->hexbuffer[ch->hexindex]=0;
ch->datasize=strtoul(ch->hexbuffer, NULL, 16);
@@ -127,7 +132,9 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
break;
case CHUNK_POSTHEX:
- /* just a lame state waiting for CRLF to arrive */
+ /* In this state, we're waiting for CRLF to arrive. We support
+ this to allow so called chunk-extensions to show up here
+ before the CRLF comes. */
if(*datap == '\r')
ch->state = CHUNK_CR;
length--;