com php-src: Merge branch 'PHP-5.6': main/SAPI.c
| From: | Anatol Belski | Date: | Mon, 10 Aug 2015 23:42:25 +0000 |
| Subject: | com php-src: Merge branch 'PHP-5.6': main/SAPI.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-88610@lists.php.net to get a copy of this message | ||
Commit: 37707b2dd663f5bb9b344ff9aa604002035be842
Author: Christoph M. Becker <cmb@php.net> Tue, 11 Aug 2015 01:42:25 +0200
Parents: 913fc54e0ffa8089fec6b6c194a763a5b5fc6a45 42ef2b500be2d9d3d8ebf77f8c701c39c150aa39
Branches: PHP-7.0.0
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=37707b2dd663f5bb9b344ff9aa604002035be842
Log:
Merge branch 'PHP-5.6'
* PHP-5.6:
Fix #69487: SAPI may truncate POST data
Bugs:
https://bugs.php.net/69487
Changed paths:
MM main/SAPI.c
Diff:
diff --cc main/SAPI.c
index f14638a,9b5ea1a..1709ab1
--- a/main/SAPI.c
+++ b/main/SAPI.c
@@@ -282,10 -287,15 +282,15 @@@ SAPI_API SAPI_POST_READER_FUNC(sapi_rea
for (;;) {
char buffer[SAPI_POST_BLOCK_SIZE];
- read_bytes = sapi_read_post_block(buffer, SAPI_POST_BLOCK_SIZE TSRMLS_CC);
+ read_bytes = sapi_read_post_block(buffer, SAPI_POST_BLOCK_SIZE);
if (read_bytes > 0) {
- php_stream_write(SG(request_info).request_body, buffer, read_bytes);
+ if (php_stream_write(SG(request_info).request_body, buffer, read_bytes) != read_bytes) {
+ /* if parts of the stream can't be written, purge it completely */
+ php_stream_truncate_set_size(SG(request_info).request_body, 0);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "POST data can't be buffered; all data
discarded");
++ php_error_docref(NULL, E_WARNING, "POST data can't be buffered; all data
discarded");
+ break;
+ }
}
if ((SG(post_max_size) > 0) && (SG(read_post_bytes) > SG(post_max_size))) {