]> granicus.if.org Git - php/commitdiff
- Make the printf functions binary clean
authorRasmus Lerdorf <rasmus@php.net>
Wed, 25 Apr 2001 21:05:59 +0000 (21:05 +0000)
committerRasmus Lerdorf <rasmus@php.net>
Wed, 25 Apr 2001 21:05:59 +0000 (21:05 +0000)
@ - Make the printf family of functions binary clean

ext/standard/formatted_print.c

index 2962147e9aa55016f7a1e1188ceaf5653f700246..ec89a0b2c020dd8f82d7a19296bd658b9da71611 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, MIN(max_width, len)+1);
+       memcpy(&(*buffer)[*pos], add, MIN(max_width, len)+1);
        *pos += MIN(max_width, len);
        if (alignment == ALIGN_LEFT) {
                while (npad--) {
@@ -411,7 +411,7 @@ php_formatted_print(int ht, int *len)
 
        currarg = 1;
 
-       while (format[inpos]) {
+       while (inpos<(*args[0])->value.str.len) {
                int expprec = 0;
 
                PRINTF_DEBUG(("sprintf: format[%d]='%c'\n", inpos, format[inpos]));