From: Stanislav Malyshev Date: Mon, 14 Aug 2000 15:54:57 +0000 (+0000) Subject: Fix print length - again X-Git-Tag: php-4.0.2RC1~117 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=159abaa9008643dc5e0df27d48e02be1140c78ee;p=php Fix print length - again # I hope _this_ is the right fix... --- diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index 2846eaaa98..04f7811c92 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -184,7 +184,7 @@ php_sprintf_appendstring(char **buffer, int *pos, int *size, char *add, } } PRINTF_DEBUG(("sprintf: appending \"%s\"\n", add)); - strncpy(&(*buffer)[*pos], add, max_width-*pos+1); + strncpy(&(*buffer)[*pos], add, MIN(max_width, len)+1); *pos += MIN(max_width, len); if (alignment == ALIGN_LEFT) { while (npad--) {