From ffc49acabc3e331022c4e9423cf85f6bb900da20 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 19 Dec 2014 18:20:55 +0300 Subject: [PATCH] Avoid NULL pointer dereferencing --- ext/standard/string.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ext/standard/string.c b/ext/standard/string.c index 419fef3d59..2668161c09 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -4274,7 +4274,11 @@ PHP_FUNCTION(setlocale) zend_string_release(loc); } - RETURN_STR(zend_string_copy(BG(locale_string))); + if (BG(locale_string)) { + RETURN_STR(zend_string_copy(BG(locale_string))); + } else { + RETURN_EMPTY_STRING(); + } } zend_string_release(loc); -- 2.50.1