summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2015-01-20 11:46:10 -0800
committerFerenc Kovacs <tyrael@php.net>2015-01-21 01:34:30 +0100
commit896b34177e11556d85fc7986d7b741b7cc9462ca (patch)
tree234a7d2dd17f1e01ada9f4e4fff9d2bc6391bcd1
parent81b4ce3ea35eace41a578643c52fb6569d7b94e5 (diff)
downloadphp-git-896b34177e11556d85fc7986d7b741b7cc9462ca.tar.gz
add protection against nulls
-rw-r--r--main/spprintf.c5
1 files changed, 5 insertions, 0 deletions
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) {