summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2003-04-16 01:07:03 +0000
committerIlia Alshanetsky <iliaa@php.net>2003-04-16 01:07:03 +0000
commit7f8bd25fccf39f8c9a5cbcbf3450356082ba1563 (patch)
tree7b6ed974c10a92792001ffb7f3c34608ce59ad0f
parent56e44a4fc235b36bb08c13e114672f7b9020b99e (diff)
downloadphp-git-7f8bd25fccf39f8c9a5cbcbf3450356082ba1563.tar.gz
Fixed bug #23225 (money_format() didn't handle erroneous return of strfmon)
# Initial patch proposed by marcot@tabini.ca
-rw-r--r--ext/standard/string.c5
1 files changed, 4 insertions, 1 deletions
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);