]> granicus.if.org Git - php/commitdiff
add protection against nulls
authorStanislav Malyshev <stas@php.net>
Tue, 20 Jan 2015 19:46:10 +0000 (11:46 -0800)
committerFerenc Kovacs <tyrael@php.net>
Wed, 21 Jan 2015 00:34:30 +0000 (01:34 +0100)
main/spprintf.c

index ff8e9643dee8b057176b2fbdc2128eb44028449b..59565232849158cd58c30552ccb3b87c33459907 100644 (file)
@@ -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) {