cvs: php4 /main user_streams.c
| From: | Wez Furlong | Date: | Tue, 19 Mar 2002 13:44:38 +0000 |
| Subject: | cvs: php4 /main user_streams.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-10416@lists.php.net to get a copy of this message | ||
wez Tue Mar 19 08:44:38 2002 EDT
Modified files:
/php4/main user_streams.c
Log:
avoid possible buffer overruns when write returns a value larger than the buffer
Index: php4/main/user_streams.c
diff -u php4/main/user_streams.c:1.2 php4/main/user_streams.c:1.3
--- php4/main/user_streams.c:1.2 Tue Mar 19 08:42:25 2002
+++ php4/main/user_streams.c Tue Mar 19 08:44:38 2002
@@ -249,6 +249,13 @@
didwrite = Z_LVAL_P(retval);
else
didwrite = 0;
+
+ /* don't allow strange buffer overruns due to bogus return */
+ if (didwrite > count) {
+ zend_error(E_WARNING, "%s::" USERSTREAM_READ " - wrote more data than
requested",
+ us->wrapper->classname);
+ didwrite = count;
+ }
if (retval)
zval_ptr_dtor(&retval);