summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2015-01-20 11:46:10 -0800
committerStanislav Malyshev <stas@php.net>2015-01-20 11:49:23 -0800
commit49af59b3a095ed1a9e61e9183cedaafcf3b5aa7f (patch)
tree28dc9244f965fb4fcf7a26d1c171689f4f510087
parente63f7b47e1937821e75e9862284c3150e1b1d524 (diff)
downloadphp-git-49af59b3a095ed1a9e61e9183cedaafcf3b5aa7f.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 5b16d51441..01d80b7548 100644
--- a/main/spprintf.c
+++ b/main/spprintf.c
@@ -796,6 +796,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) {