From: Jouni Ahto Date: Wed, 31 May 2000 22:27:09 +0000 (+0000) Subject: Fix a nasty off-by-one with negative numbers. X-Git-Tag: PRE_EIGHT_BYTE_ALLOC_PATCH~165 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1e7c5b8562de9370b5c4174951ea7fbc93b2944d;p=php Fix a nasty off-by-one with negative numbers. # Hey, this has been there for years undetected. --- diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index 9a4c67c5ca..93f7acae6d 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -159,6 +159,10 @@ php_sprintf_appendstring(char **buffer, int *pos, int *size, char *add, npad=0; } + if (sign) { + len--; + } + PRINTF_DEBUG(("sprintf: appendstring(%x, %d, %d, \"%s\", %d, '%c', %d)\n", *buffer, *pos, *size, add, min_width, padding, alignment)); if (max_width == 0) {