com php-src: fix signed/unsigned mismatch: sapi/cgi/cgi_main .c
| From: | Anatol Belski | Date: | Mon, 13 Oct 2014 16:43:10 +0000 |
| Subject: | com php-src: fix signed/unsigned mismatch: sapi/cgi/cgi_main .c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-82271@lists.php.net to get a copy of this message | ||
Commit: 97319bc83357628b79d18702e82fba4b7f252e05
Author: Anatol Belski <ab@php.net> Mon, 13 Oct 2014 11:32:13 +0200
Parents: 84477c7c3963b175c2c31fff63b5297587e92858
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=97319bc83357628b79d18702e82fba4b7f252e05
Log:
fix signed/unsigned mismatch
Changed paths:
M sapi/cgi/cgi_main.c
Diff:
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index dead1c3..f067875 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) {