com php-src: Fix smart_str_append(): ext/standard/p hp_smart_str.h

From: Date: Thu, 04 Sep 2014 19:55:27 +0000
Subject: com php-src: Fix smart_str_append(): ext/standard/p hp_smart_str.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-81430@lists.php.net to get a copy of this message
Commit: 0c5ac397961136be2f53e4c62f2655e54f20bf71 Author: Nikita Popov <nikic@php.net> Thu, 4 Sep 2014 21:55:27 +0200 Parents: 00805ffb92077bb51d83ad7d0475a501589a7f21 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0c5ac397961136be2f53e4c62f2655e54f20bf71 Log: Fix smart_str_append() Would segfault if src->s == NULL. Changed paths: M ext/standard/php_smart_str.h Diff: diff --git a/ext/standard/php_smart_str.h b/ext/standard/php_smart_str.h index c153fa8..8b79e3e 100644 --- a/ext/standard/php_smart_str.h +++ b/ext/standard/php_smart_str.h @@ -158,9 +158,11 @@ static inline char *smart_str_print_unsigned(char *buf, zend_long num) { #define smart_str_append_off_t_ex(dest, num, type) \ smart_str_append_generic_ex((dest), (num), (type), zend_off_t, _signed) -#define smart_str_append_ex(dest, src, what) \ - smart_str_appendl_ex((dest), ((smart_str *)(src))->s->val, \ - ((smart_str *)(src))->s->len, (what)); +#define smart_str_append_ex(dest, src, what) do { \ + if ((src)->s && (src)->s->len) { \ + smart_str_appendl_ex((dest), (src)->s->val, (src)->s->len, (what)); \ + } \ +} while(0) #define smart_str_setl(dest, src, nlen) do { \ smart_str_free((dest)); \

« previous php.cvs (#81430) next »