From 896b34177e11556d85fc7986d7b741b7cc9462ca Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Tue, 20 Jan 2015 11:46:10 -0800 Subject: [PATCH] add protection against nulls --- main/spprintf.c | 5 +++++ 1 file changed, 5 insertions(+) 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) { -- 2.50.1