File php-CVE-2014-9427.patch of Package php5.openSUSE_Leap_42.1_Update
http://git.php.net/?p=php-src.git;a=commit;h=f9ad3086693fce680fbe246e4a45aa92edd2ac35
Index: sapi/cgi/cgi_main.c
===================================================================
--- sapi/cgi/cgi_main.c.orig 2015-01-05 17:05:35.584546329 +0100
+++ sapi/cgi/cgi_main.c 2015-01-05 17:06:02.786896356 +0100
@@ -2435,14 +2435,17 @@
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;
}