diff options
author | Stanislav Malyshev <stas@php.net> | 2015-01-20 11:46:10 -0800 |
---|---|---|
committer | Julien Pauli <jpauli@php.net> | 2015-01-21 10:14:39 +0100 |
commit | 7ce410b28d37bbabcbd3129e2ec4e6bd31b62dd0 (patch) | |
tree | b3cfcd9fc5f9d420b4021105dd76796e46d405ca | |
parent | 55001de6d8c6ed2aada870a76de1e4b4558737bf (diff) | |
download | php-git-7ce410b28d37bbabcbd3129e2ec4e6bd31b62dd0.tar.gz |
add protection against nulls
-rw-r--r-- | main/spprintf.c | 5 |
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) { |