From 7f8bd25fccf39f8c9a5cbcbf3450356082ba1563 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Wed, 16 Apr 2003 01:07:03 +0000 Subject: [PATCH] Fixed bug #23225 (money_format() didn't handle erroneous return of strfmon) # Initial patch proposed by marcot@tabini.ca --- ext/standard/string.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); -- 2.40.0