summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/spprintf.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/main/spprintf.c b/main/spprintf.c
index 9eed37ca60..56ffe515c8 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) {