Skip to content

Commit 7ce410b

Browse files
smalyshevJulien Pauli
authored andcommitted
add protection against nulls
1 parent 55001de commit 7ce410b

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
@@ -813,6 +813,11 @@ PHPAPI int vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap
813813
{
814814
smart_str xbuf = {0};
815815

816+
/* since there are places where (v)spprintf called without checking for null,
817+
a bit of defensive coding here */
818+
if(!pbuf) {
819+
return 0;
820+
}
816821
xbuf_format_converter(&xbuf, format, ap);
817822

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

0 commit comments

Comments
 (0)