Skip to content

Commit 1ce830a

Browse files
committed
Fix another pointer indexing UB in http_fopen_wrapper
Only compute the gep after checking whether the pointer is NULL.
1 parent 11f3e24 commit 1ce830a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/standard/http_fopen_wrapper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ static inline void strip_header(char *header_bag, char *lc_header_bag,
9191
) {
9292
char *header_start = header_bag + (lc_header_start - lc_header_bag);
9393
char *lc_eol = strchr(lc_header_start, '\n');
94-
char *eol = header_start + (lc_eol - lc_header_start);
9594

9695
if (lc_eol) {
96+
char *eol = header_start + (lc_eol - lc_header_start);
9797
size_t eollen = strlen(lc_eol);
9898

9999
memmove(lc_header_start, lc_eol+1, eollen);

0 commit comments

Comments
 (0)