]> granicus.if.org Git - php/commitdiff
Fix a nasty off-by-one with negative numbers.
authorJouni Ahto <jah@php.net>
Wed, 31 May 2000 22:27:09 +0000 (22:27 +0000)
committerJouni Ahto <jah@php.net>
Wed, 31 May 2000 22:27:09 +0000 (22:27 +0000)
# Hey, this has been there for years undetected.

ext/standard/formatted_print.c

index 9a4c67c5caa82c300d1a918c61af166fb63525d8..93f7acae6da1c6e1d48246d3ed2eab617adaffa5 100644 (file)
@@ -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) {