From: Michael Wallner Date: Sat, 10 Dec 2005 19:00:40 +0000 (+0000) Subject: - fix config.m4 X-Git-Tag: RELEASE_0_20_0~30 X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=commitdiff_plain;h=64de794f91af7565602a1183c5ed3fda2de99f35;ds=sidebyside - fix config.m4 - fix some read beyond errors found thanks to run-tests -m --- diff --git a/config.m4 b/config.m4 index 26832b9..9cb0973 100644 --- a/config.m4 +++ b/config.m4 @@ -79,7 +79,7 @@ dnl ---- CURL_LIBS=`$CURL_CONFIG --libs` - CURL_ZLIB= `$CURL_CONFIG --features | $EGREP libz` + CURL_ZLIB=`$CURL_CONFIG --features | $EGREP libz` if test "$CURL_ZLIB" = "libz"; then AC_DEFINE([HTTP_HAVE_CURL_ZLIB], [1], [ ]) fi diff --git a/http_api.c b/http_api.c index 6f6c5d6..04e0121 100644 --- a/http_api.c +++ b/http_api.c @@ -283,7 +283,7 @@ STATUS _http_check_method_ex(const char *method, const char *methods) if ( (found = strstr(methods, method)) && (found == method || !isalpha(found[-1])) && - (!isalpha(found[strlen(method) + 1]))) { + (strlen(found) >= strlen(method) && !isalpha(found[strlen(method)]))) { return SUCCESS; } return FAILURE; diff --git a/http_headers_api.c b/http_headers_api.c index c04664e..a45e282 100644 --- a/http_headers_api.c +++ b/http_headers_api.c @@ -357,8 +357,8 @@ PHP_HTTP_API STATUS _http_parse_headers_ex(const char *header, HashTable *header header_len = strlen(header) + 1; } line = header; - - while (header_len >= (size_t) (line - begin)) { + + if (header_len) do { int value_len = 0; /* note: valgrind may choke on that -- should be safe though */ switch (*line++) @@ -372,7 +372,7 @@ PHP_HTTP_API STATUS _http_parse_headers_ex(const char *header, HashTable *header case 0: --value_len; /* we don't have CR so value length is one char less */ case '\n': - if ((!(*line - 1)) || ((*line != ' ') && (*line != '\t'))) { + if ((!*(line - 1)) || ((*line != ' ') && (*line != '\t'))) { http_info i; /* response/request line */ @@ -429,7 +429,8 @@ PHP_HTTP_API STATUS _http_parse_headers_ex(const char *header, HashTable *header } break; } - } + } while (header_len > (size_t) (line - begin)); + return SUCCESS; } /* }}} */ diff --git a/tests/encodings.phpt b/tests/encodings.phpt index f14867f..e2e08e7 100644 --- a/tests/encodings.phpt +++ b/tests/encodings.phpt @@ -9,6 +9,7 @@ skipif(!function_exists('http_gzencode'), 'need zlib');