com php-src: add protection against nulls: main/spprintf.c
| From: | JulienPauli | Date: | Wed, 21 Jan 2015 09:14:39 +0000 |
| Subject: | com php-src: add protection against nulls: main/spprintf.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-84266@lists.php.net to get a copy of this message | ||
Commit: 7ce410b28d37bbabcbd3129e2ec4e6bd31b62dd0
Author: Stanislav Malyshev <stas@php.net> Tue, 20 Jan 2015 11:46:10 -0800
Committer: Julien Pauli <jpauli@php.net> Wed, 21 Jan 2015 10:14:39 +0100
Parents: 55001de6d8c6ed2aada870a76de1e4b4558737bf
Branches: PHP-5.5.21
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7ce410b28d37bbabcbd3129e2ec4e6bd31b62dd0
Log:
add protection against nulls
Changed paths:
M main/spprintf.c
Diff:
diff --git a/main/spprintf.c b/main/spprintf.c
index ff8e964..5956523 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) {