From: Ilia Alshanetsky Date: Wed, 16 Apr 2003 01:07:03 +0000 (+0000) Subject: Fixed bug #23225 (money_format() didn't handle erroneous return of strfmon) X-Git-Tag: RELEASE_0_5~32 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7f8bd25fccf39f8c9a5cbcbf3450356082ba1563;p=php Fixed bug #23225 (money_format() didn't handle erroneous return of strfmon) # Initial patch proposed by marcot@tabini.ca --- diff --git a/ext/standard/string.c b/ext/standard/string.c index 9e99ccff6c..0f1780a3cf 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -4372,7 +4372,10 @@ PHP_FUNCTION(money_format) str_len = format_len + 1024; str = emalloc(str_len); - str_len = strfmon(str, str_len, format, value); + if ((str_len = strfmon(str, str_len, format, value)) < 0) { + efree(str); + RETURN_FALSE; + } str[str_len] = 0; RETURN_STRINGL(erealloc(str, str_len + 1), str_len, 0);