]> granicus.if.org Git - php/commitdiff
http parser code assumes char is signed
authorAnton Blanchard <anton@samba.org>
Sun, 5 Jul 2015 23:41:09 +0000 (09:41 +1000)
committerAnton Blanchard <anton@samba.org>
Mon, 6 Jul 2015 00:13:00 +0000 (10:13 +1000)
A char can be either signed or unsigned, and on PowerPC and ARM it is
unsigned. The following code will always be false on these architectures:

        if (c == -1) goto error;

sapi/cli/php_http_parser.c

index d289e80f7040955b91edfbc44f43e840a37a9a37..aa9f28638f479e4172b9bfb63f47139a1adff0ce 100644 (file)
@@ -326,7 +326,8 @@ size_t php_http_parser_execute (php_http_parser *parser,
                             const char *data,
                             size_t len)
 {
-  char c, ch;
+  char ch;
+  signed char c;
   const char *p = data, *pe;
   size_t to_read;