]> granicus.if.org Git - php/commitdiff
Fix print length - again
authorStanislav Malyshev <stas@php.net>
Mon, 14 Aug 2000 15:54:57 +0000 (15:54 +0000)
committerStanislav Malyshev <stas@php.net>
Mon, 14 Aug 2000 15:54:57 +0000 (15:54 +0000)
# I hope _this_ is the right fix...

ext/standard/formatted_print.c

index 2846eaaa9840a12b076da5457cc2d0d0365a0850..04f7811c92935809fef94640fecfd16c95792dd4 100644 (file)
@@ -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--) {