- fix endless loop with bad input
authorMichael Wallner <mike@php.net>
Mon, 14 Nov 2005 14:49:45 +0000 (14:49 +0000)
committerMichael Wallner <mike@php.net>
Mon, 14 Nov 2005 14:49:45 +0000 (14:49 +0000)
http_filter_api.c

index 53877e2a3f08d3f4c281125009f856fc5813d46b..421c07fb289e7455a35dde4c64af94c38d422a7e 100644 (file)
@@ -114,7 +114,7 @@ static HTTP_FILTER_FUNCTION(chunked_decode)
 
        /* we have data in our buffer */
        while (PHPSTR_LEN(buffer)) {
-       
+       fprintf(stderr, ">>> loop\n");
                /* we already know the size of the chunk and are waiting for data */
                if (buffer->hexlen) {
                
@@ -191,6 +191,9 @@ static HTTP_FILTER_FUNCTION(chunked_decode)
                                        phpstr_cut(PHPSTR(buffer), 0, eolstr + eollen - PHPSTR_VAL(buffer));
                                        /* buffer->hexlen is 0 now or contains the size of the next chunk */
                                        /* continue */
+                               } else {
+                                       /* we have not enough data buffered to read in chunk size */
+                                       break;
                                }
                        }
                        /* break */