]> granicus.if.org Git - php/commitdiff
Avoid NULL pointer dereferencing
authorDmitry Stogov <dmitry@zend.com>
Fri, 19 Dec 2014 15:20:55 +0000 (18:20 +0300)
committerDmitry Stogov <dmitry@zend.com>
Fri, 19 Dec 2014 15:20:55 +0000 (18:20 +0300)
ext/standard/string.c

index 419fef3d59abda3b260c862babf1d33f011c1199..2668161c09d44bbfe8c945994a2df5152f366561 100644 (file)
@@ -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);