Skip to content

Commit ef4896d

Browse files
committed
add protection against nulls
1 parent 8825311 commit ef4896d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

main/spprintf.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,11 @@ PHPAPI int vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap
796796
{
797797
smart_str xbuf = {0};
798798

799+
/* since there are places where (v)spprintf called without checking for null,
800+
a bit of defensive coding here */
801+
if(!pbuf) {
802+
return 0;
803+
}
799804
xbuf_format_converter(&xbuf, format, ap);
800805

801806
if (max_len && xbuf.len > max_len) {

0 commit comments

Comments
 (0)