com php-src: add protection against nulls: main/spprintf.c
| From: | Stanislav Malyshev | Date: | Tue, 20 Jan 2015 19:46:10 +0000 |
| Subject: | com php-src: add protection against nulls: main/spprintf.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-84217@lists.php.net to get a copy of this message | ||
Commit: ef4896d95659af261369bfa2e3c3f2c0317a83e8
Author: Stanislav Malyshev <stas@php.net> Tue, 20 Jan 2015 11:46:10 -0800
Parents: 8825311ce1e9b0c3b627ff32808dd4e0d577c136
Branches: PHP-5.4 PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ef4896d95659af261369bfa2e3c3f2c0317a83e8
Log:
add protection against nulls
Changed paths:
M main/spprintf.c
Diff:
diff --git a/main/spprintf.c b/main/spprintf.c
index 5b16d51..01d80b7 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) {