dmitry          Thu May 25 06:40:47 2006 UTC

  Modified files:              
    /php-src/sapi/cgi   fastcgi.c 
  Log:
  Fixed bug #37496 (FastCGI output buffer overrun)
  
  
http://cvs.php.net/viewcvs.cgi/php-src/sapi/cgi/fastcgi.c?r1=1.18&r2=1.19&diff_format=u
Index: php-src/sapi/cgi/fastcgi.c
diff -u php-src/sapi/cgi/fastcgi.c:1.18 php-src/sapi/cgi/fastcgi.c:1.19
--- php-src/sapi/cgi/fastcgi.c:1.18     Mon May 22 09:23:01 2006
+++ php-src/sapi/cgi/fastcgi.c  Thu May 25 06:40:47 2006
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: fastcgi.c,v 1.18 2006/05/22 09:23:01 dmitry Exp $ */
+/* $Id: fastcgi.c,v 1.19 2006/05/25 06:40:47 dmitry Exp $ */
 
 #include "php.h"
 #include "fastcgi.h"
@@ -798,6 +798,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) {
@@ -810,8 +811,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