Skip to content

Commit f9d7309

Browse files
committed
NULL terminate "0"
1 parent de2038c commit f9d7309

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ext/standard/math.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,8 @@ PHPAPI zend_string *_php_math_number_format_long(zend_long num, int dec, const c
11571157
reslen = 1;
11581158
res = zend_string_alloc(reslen, 0);
11591159
t = ZSTR_VAL(res);
1160-
*t = '0';
1160+
*t++ = '0';
1161+
*t = '\0';
11611162

11621163
ZSTR_LEN(res) = reslen;
11631164
zend_string_release_ex(tmpbuf, 0);
@@ -1238,7 +1239,7 @@ PHPAPI zend_string *_php_math_number_format_long(zend_long num, int dec, const c
12381239
}
12391240

12401241
if (neg) {
1241-
*t = '-';
1242+
*t-- = '-';
12421243
}
12431244

12441245
/* Allocate more bytes in case we have to round up to more places than initially thought

0 commit comments

Comments
 (0)