cvs: php4 /ext/standard/ formatted_print.c

[email protected] ("Jouni Ahto") Wed, 31 May 2000 22:27:09 -0000
Newsgroups php.version4
Message-ID <cvsjah959812029@cvsserver>
jah		Wed May 31 15:27:09 2000 EDT

  Modified files:
    /php4/ext/standard	formatted_print.c 
  Log:
  
  Fix a nasty off-by-one with negative numbers.
  # Hey, this has been there for years undetected.
  
  
Index: php4/ext/standard/formatted_print.c
diff -u php4/ext/standard/formatted_print.c:1.17 php4/ext/standard/formatted_print.c:1.18
--- php4/ext/standard/formatted_print.c:1.17	Thu May 18 08:34:35 2000
+++ php4/ext/standard/formatted_print.c	Wed May 31 15:27:09 2000
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: formatted_print.c,v 1.17 2000/05/18 15:34:35 zeev Exp $ */
+/* $Id: formatted_print.c,v 1.18 2000/05/31 22:27:09 jah Exp $ */
 
 #include <math.h>				/* modf() */
 #include "php.h"
@@ -157,6 +157,10 @@
 
 	if (npad<0) {
 		npad=0;
+	}
+	
+	if (sign) {
+		len--;
 	}
 	
 	PRINTF_DEBUG(("sprintf: appendstring(%x, %d, %d, \"%s\", %d, '%c', %d)\n",