summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2015-01-20 11:46:39 -0800
committerStanislav Malyshev <stas@php.net>2015-01-20 11:46:39 -0800
commita3cb69d63eb6f0814433ace9df5d9ab405f97d1a (patch)
tree689a8bdb447f13f777a5f107c374b31183c968db
parente2744c51b63d1e7c023f25927d3300d647bd97fe (diff)
parentef4896d95659af261369bfa2e3c3f2c0317a83e8 (diff)
downloadphp-git-a3cb69d63eb6f0814433ace9df5d9ab405f97d1a.tar.gz
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4: 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 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) {