cvs: php4 /main snprintf.c
| From: | Ilia Alshanetsky | Date: | Mon, 05 May 2003 19:54:28 +0000 |
| Subject: | cvs: php4 /main snprintf.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-20712@lists.php.net to get a copy of this message | ||
iliaa Mon May 5 15:54:28 2003 EDT
Modified files:
/php4/main snprintf.c
Log:
Sanity check that ensures proper handling of 'E' doubles/floats as well as
prevents an unlikely buffer overflow.
Index: php4/main/snprintf.c
diff -u php4/main/snprintf.c:1.21 php4/main/snprintf.c:1.22
--- php4/main/snprintf.c:1.21 Tue Feb 25 04:44:12 2003
+++ php4/main/snprintf.c Mon May 5 15:54:28 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: snprintf.c,v 1.21 2003/02/25 09:44:12 sniper Exp $ */
+/* $Id: snprintf.c,v 1.22 2003/05/05 19:54:28 iliaa Exp $ */
/* ====================================================================
* Copyright (c) 1995-1998 The Apache Group. All rights reserved.
@@ -386,6 +386,10 @@
register char *p1, *p2;
register int i;
char buf1[NDIG];
+
+ if (ndigit >= NDIG - 1) {
+ ndigit = NDIG - 2;
+ }
p1 = ap_php_ecvt(number, ndigit, &decpt, &sign, buf1);
p2 = buf;