Fix another pointer indexing UB in http_fopen_wrapper

Only compute the gep after checking whether the pointer is NULL.
This commit is contained in:
Nikita Popov 2019-09-11 10:31:03 +02:00
parent 11f3e24190
commit 1ce830a4aa

View File

@ -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);