dmitry          Thu May 25 06:40:21 2006 UTC

  Modified files:              (Branch: PHP_5_1)
    /php-src    NEWS 
    /php-src/sapi/cgi   fastcgi.c 
  Log:
  Fixed bug #37496 (FastCGI output buffer overrun)
  
  
http://cvs.php.net/viewcvs.cgi/php-src/NEWS?r1=1.2027.2.556&r2=1.2027.2.557&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.556 php-src/NEWS:1.2027.2.557
--- php-src/NEWS:1.2027.2.556   Wed May 24 09:42:46 2006
+++ php-src/NEWS        Thu May 25 06:40:21 2006
@@ -1,6 +1,7 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2006, PHP 5.?.?
+- Fixed bug #37496 (FastCGI output buffer overrun). (Piotr, Dmitry)
 - Fixed bug #37487 (oci_fetch_array() array-type should always default to
   OCI_BOTH). (Tony)
 - Fixed bug #37416 (iterator_to_array() hides exceptions thrown in rewind() 
http://cvs.php.net/viewcvs.cgi/php-src/sapi/cgi/fastcgi.c?r1=1.4.2.14&r2=1.4.2.15&diff_format=u
Index: php-src/sapi/cgi/fastcgi.c
diff -u php-src/sapi/cgi/fastcgi.c:1.4.2.14 php-src/sapi/cgi/fastcgi.c:1.4.2.15
--- php-src/sapi/cgi/fastcgi.c:1.4.2.14 Mon May 22 09:22:40 2006
+++ php-src/sapi/cgi/fastcgi.c  Thu May 25 06:40:21 2006
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: fastcgi.c,v 1.4.2.14 2006/05/22 09:22:40 dmitry Exp $ */
+/* $Id: fastcgi.c,v 1.4.2.15 2006/05/25 06:40:21 dmitry Exp $ */
 
 #include "fastcgi.h"
 #include "php.h"
@@ -803,6 +803,7 @@
        limit = sizeof(req->out_buf) - (req->out_pos - req->out_buf);
        if (!req->out_hdr) {
                limit -= sizeof(fcgi_header);
+               if (limit < 0) limit = 0;
        }
 
        if (len < limit) {
@@ -815,8 +816,10 @@
                if (!req->out_hdr) {
                        open_packet(req, type);
                }
-               memcpy(req->out_pos, str, limit);
-               req->out_pos += limit;
+               if (limit > 0) {
+                       memcpy(req->out_pos, str, limit);
+                       req->out_pos += limit;
+               }
                if (!fcgi_flush(req, 0)) {
                        return -1;
                }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to