com php-src: FIx bug #68618 (out of bounds read crashes php-cgi): NEWS sapi/cgi/cgi_main.c

From: Date: Tue, 30 Dec 2014 09:23:05 +0000
Subject: com php-src: FIx bug #68618 (out of bounds read crashes php-cgi): NEWS sapi/cgi/cgi_main.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-83928@lists.php.net to get a copy of this message
Commit: f9ad3086693fce680fbe246e4a45aa92edd2ac35 Author: Stanislav Malyshev <stas@php.net> Tue, 30 Dec 2014 01:23:05 -0800 Parents: cd387b457572709cbaaaee15ccc0db1185a3c23a Branches: PHP-5.4 PHP-5.5 PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f9ad3086693fce680fbe246e4a45aa92edd2ac35 Log: FIx bug #68618 (out of bounds read crashes php-cgi) Bugs: https://bugs.php.net/68618 Changed paths: M NEWS M sapi/cgi/cgi_main.c Diff: diff --git a/NEWS b/NEWS index 581f3a6..fa57ef3 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,8 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 20?? PHP 5.4.37 +- CGI: + . Fix bug #68618 (out of bounds read crashes php-cgi). (Stas) 18 Dec 2014 PHP 5.4.36 diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index b8ff878..0af98a4 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -2429,14 +2429,17 @@ consult the installation file that came with this distribution, or visit \n\ int i = 1; c = file_handle.handle.stream.mmap.buf[i++]; - while (c != '\n' && c != '\r' && c != EOF) { + while (c != '\n' && c != '\r' && i < file_handle.handle.stream.mmap.len) { c = file_handle.handle.stream.mmap.buf[i++]; } if (c == '\r') { - if (file_handle.handle.stream.mmap.buf[i] == '\n') { + if (i < file_handle.handle.stream.mmap.len && file_handle.handle.stream.mmap.buf[i] == '\n') { i++; } } + if(i > file_handle.handle.stream.mmap.len) { + i = file_handle.handle.stream.mmap.len; + } file_handle.handle.stream.mmap.buf += i; file_handle.handle.stream.mmap.len -= i; }

« previous php.cvs (#83928) next »