Skip to content

Commit 8c292a2

Browse files
AlexeyZamorovnikic
authored andcommitted
Avoid dangling pointer in curl header.str
If buf_len is zero, this would leave behind a dangling pointer to an already released header.str. Make sure this can't happen by always overwriting the pointer. Closes GH-7376.
1 parent 30e791e commit 8c292a2

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

ext/curl/interface.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1766,9 +1766,7 @@ static int curl_debug(CURL *cp, curl_infotype type, char *buf, size_t buf_len, v
17661766
if (ch->header.str) {
17671767
zend_string_release_ex(ch->header.str, 0);
17681768
}
1769-
if (buf_len > 0) {
1770-
ch->header.str = zend_string_init(buf, buf_len, 0);
1771-
}
1769+
ch->header.str = zend_string_init(buf, buf_len, 0);
17721770
}
17731771

17741772
return 0;

0 commit comments

Comments
 (0)