From: Stanislav Malyshev Date: Tue, 20 Jan 2015 19:46:10 +0000 (-0800) Subject: add protection against nulls X-Git-Tag: php-5.5.21~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7ce410b28d37bbabcbd3129e2ec4e6bd31b62dd0;p=php add protection against nulls --- diff --git a/main/spprintf.c b/main/spprintf.c index ff8e9643de..5956523284 100644 --- a/main/spprintf.c +++ b/main/spprintf.c @@ -813,6 +813,11 @@ PHPAPI int vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap { smart_str xbuf = {0}; + /* since there are places where (v)spprintf called without checking for null, + a bit of defensive coding here */ + if(!pbuf) { + return 0; + } xbuf_format_converter(&xbuf, format, ap); if (max_len && xbuf.len > max_len) {