From b364219adef61e15bb32b7255e22bc4c6a5911bc Mon Sep 17 00:00:00 2001 From: Scott MacVicar Date: Mon, 8 Dec 2008 02:33:46 +0000 Subject: [PATCH] Fix bug #46748, segfault when SSL has more than one error message. --- NEWS | 1 + ext/openssl/xp_ssl.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 4dde03ba2b..e79f7cb3fb 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,7 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2009, PHP 5.2.9 - Fixed bug #46782 (fastcgi.c parse error). (Matt) +- Fixed bug #46748 (Segfault when an SSL error has more than one error.) (Scott) - Fixed bug #46739 (array returned by curl_getinfo should contain content_type key). (Mikko) diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c index 6b052ec73a..f8fcb6d133 100644 --- a/ext/openssl/xp_ssl.c +++ b/ext/openssl/xp_ssl.c @@ -152,9 +152,10 @@ static int handle_ssl_error(php_stream *stream, int nr_bytes, zend_bool is_init ERR_error_string_n(ecode, esbuf, sizeof(esbuf) - 1); } code = strlen(esbuf); - esbuf[code] = '\0'; ebuf = erealloc(ebuf, ebuf_size + code + 1); + ebuf_size += code; + if (wptr == NULL) { wptr = ebuf; } -- 2.50.1