diff options
author | Anatol Belski <ab@php.net> | 2014-10-13 11:32:13 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-10-13 18:43:10 +0200 |
commit | 97319bc83357628b79d18702e82fba4b7f252e05 (patch) | |
tree | c14496d82348c7ffb93e109c07778795b826c9a9 | |
parent | 84477c7c3963b175c2c31fff63b5297587e92858 (diff) | |
download | php-git-97319bc83357628b79d18702e82fba4b7f252e05.tar.gz |
fix signed/unsigned mismatch
-rw-r--r-- | sapi/cgi/cgi_main.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index dead1c3213..f06787543e 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -509,8 +509,13 @@ static size_t sapi_cgi_read_post(char *buffer, size_t count_bytes TSRMLS_DC) { size_t read_bytes = 0; int tmp_read_bytes; + size_t remaining_bytes; - count_bytes = MIN(count_bytes, SG(request_info).content_length - SG(read_post_bytes)); + assert(SG(request_info).content_length >= SG(read_post_bytes)); + + remaining_bytes = (size_t)(SG(request_info).content_length - SG(read_post_bytes)); + + count_bytes = MIN(count_bytes, remaining_bytes); while (read_bytes < count_bytes) { tmp_read_bytes = read(STDIN_FILENO, buffer + read_bytes, count_bytes - read_bytes); if (tmp_read_bytes <= 0) { |