summaryrefslogtreecommitdiff
path: root/ext/standard/http_fopen_wrapper.c
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2018-02-20 15:34:43 -0800
committerStanislav Malyshev <stas@php.net>2018-02-26 22:25:51 -0800
commit523f230c831d7b33353203fa34aee4e92ac12bba (patch)
tree09ba7eef6800786eb6821b9c9ad4fd5a72d74b8c /ext/standard/http_fopen_wrapper.c
parent1f4b057b631f9c9672cfd180090d8f52197bf806 (diff)
downloadphp-git-523f230c831d7b33353203fa34aee4e92ac12bba.tar.gz
Fix bug #75981: prevent reading beyond buffer start
Diffstat (limited to 'ext/standard/http_fopen_wrapper.c')
-rw-r--r--ext/standard/http_fopen_wrapper.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index ed6adc0039..78bd935a0e 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -737,9 +737,9 @@ finish:
tmp_line, response_code);
}
}
- if (tmp_line[tmp_line_len - 1] == '\n') {
+ if (tmp_line_len >= 1 && tmp_line[tmp_line_len - 1] == '\n') {
--tmp_line_len;
- if (tmp_line[tmp_line_len - 1] == '\r') {
+ if (tmp_line_len >= 1 &&tmp_line[tmp_line_len - 1] == '\r') {
--tmp_line_len;
}
}