mirror of
https://github.com/php/php-src.git
synced 2024-12-20 23:39:46 +08:00
Avoid pointer UB in strip_header
Don't calculate header_start if lc_header_start is NULL, as we're going to overflow the address space in that case.
This commit is contained in:
parent
265af40a0a
commit
518c651c66
@ -86,11 +86,10 @@ static inline void strip_header(char *header_bag, char *lc_header_bag,
|
||||
const char *lc_header_name)
|
||||
{
|
||||
char *lc_header_start = strstr(lc_header_bag, lc_header_name);
|
||||
char *header_start = header_bag + (lc_header_start - lc_header_bag);
|
||||
|
||||
if (lc_header_start
|
||||
&& (lc_header_start == lc_header_bag || *(lc_header_start-1) == '\n')
|
||||
) {
|
||||
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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user