]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
httpc: fix the EOC test in http_client_data_chunked()
authorJaroslav Kysela <perex@perex.cz>
Fri, 28 Nov 2014 10:40:21 +0000 (11:40 +0100)
committerJaroslav Kysela <perex@perex.cz>
Fri, 28 Nov 2014 10:40:21 +0000 (11:40 +0100)
src/httpc.c

index 8984d28c653f07c6ad6ea4c8f67a0ee039a39794..3c5486097fe5e852d868506845437885bb2af644 100644 (file)
@@ -740,7 +740,7 @@ http_client_data_chunked( http_client_t *hc, char *buf, size_t len, int *end )
     }
     l = 0;
     if (hc->hc_chunk_csize) {
-      s = d = hc->hc_chunk;
+      s = hc->hc_chunk;
       if (buf[0] == '\n' && s[hc->hc_chunk_csize-1] == '\r')
         l = 1;
       else if (len > 1 && buf[0] == '\r' && buf[1] == '\n')
@@ -766,7 +766,10 @@ http_client_data_chunked( http_client_t *hc, char *buf, size_t len, int *end )
           return res;
         continue;
       }
-      if (s[0] == '0' && s[1] == '\0')
+      d = s + 1;
+      while (*d == '0' && *d)
+        d++;
+      if (s[0] == '0' && *d == '\0')
         hc->hc_chunk_trails = 1;
       else {
         hc->hc_chunk_size = strtoll(s, NULL, 16);