cvs: php4 /ext/standard formatted_print.c
| From: | Stanislav Malyshev | Date: | Mon, 14 Aug 2000 11:07:29 +0000 |
| Subject: | cvs: php4 /ext/standard formatted_print.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-1172@lists.php.net to get a copy of this message | ||
stas Mon Aug 14 04:07:29 2000 EDT
Modified files:
/php4/ext/standard formatted_print.c
Log:
Fix another crash with long formats (#6145)
# From strncpy manual:
# In the case where the length of src is less than that of
# n, the remainder of dest will be padded with nulls.
Index: php4/ext/standard/formatted_print.c
diff -u php4/ext/standard/formatted_print.c:1.24 php4/ext/standard/formatted_print.c:1.25
--- php4/ext/standard/formatted_print.c:1.24 Mon Aug 14 03:02:14 2000
+++ php4/ext/standard/formatted_print.c Mon Aug 14 04:07:28 2000
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: formatted_print.c,v 1.24 2000/08/14 10:02:14 stas Exp $ */
+/* $Id: formatted_print.c,v 1.25 2000/08/14 11:07:28 stas Exp $ */
#include <math.h> /* modf() */
#include "php.h"
@@ -184,7 +184,7 @@
}
}
PRINTF_DEBUG(("sprintf: appending \"%s\"\n", add));
- strncpy(&(*buffer)[*pos], add, max_width);
+ strncpy(&(*buffer)[*pos], add, max_width-*pos+1);
*pos += MIN(max_width, len);
if (alignment == ALIGN_LEFT) {
while (npad--) {