From 1e7c5b8562de9370b5c4174951ea7fbc93b2944d Mon Sep 17 00:00:00 2001 From: Jouni Ahto Date: Wed, 31 May 2000 22:27:09 +0000 Subject: [PATCH] Fix a nasty off-by-one with negative numbers. # Hey, this has been there for years undetected. --- ext/standard/formatted_print.c | 4 ++++ 1 file changed, 4 insertions(+) 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) { -- 2.50.1