diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-09-11 10:31:03 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-09-11 10:31:03 +0200 |
commit | 1ce830a4aaa626a6c33835297273249eefb8e643 (patch) | |
tree | 166e69acb5c74337b7a35e5ffefaa1ef323e56cd | |
parent | 11f3e24190fa45689c8ccaeea54a28db6752092e (diff) | |
download | php-git-1ce830a4aaa626a6c33835297273249eefb8e643.tar.gz |
Fix another pointer indexing UB in http_fopen_wrapper
Only compute the gep after checking whether the pointer is NULL.
-rw-r--r-- | ext/standard/http_fopen_wrapper.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index ff0b54798f..478132fd40 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -91,9 +91,9 @@ static inline void strip_header(char *header_bag, char *lc_header_bag, ) { char *header_start = header_bag + (lc_header_start - lc_header_bag); char *lc_eol = strchr(lc_header_start, '\n'); - char *eol = header_start + (lc_eol - lc_header_start); if (lc_eol) { + char *eol = header_start + (lc_eol - lc_header_start); size_t eollen = strlen(lc_eol); memmove(lc_header_start, lc_eol+1, eollen); |