]> granicus.if.org Git - php/commitdiff
use strlcpy()
authorAntony Dovgal <tony2001@php.net>
Thu, 28 Dec 2006 20:45:20 +0000 (20:45 +0000)
committerAntony Dovgal <tony2001@php.net>
Thu, 28 Dec 2006 20:45:20 +0000 (20:45 +0000)
ext/fdf/fdf.c
ext/mime_magic/mime_magic.c

index c337467feace76a7c18e333b63baec13631e0a55..842fd54c83aa96634195febaef19f3bc17cfbdfd 100644 (file)
@@ -1726,8 +1726,7 @@ PHP_FUNCTION(fdf_get_attachment) {
                RETURN_FALSE;
        }
 
-       strncpy(pathbuf , savepath, MAXPATHLEN-1);
-       pathbuf[MAXPATHLEN-1] = '\0';
+       strlcpy(pathbuf, savepath, sizeof(pathbuf));
 
        if(0 == stat(pathbuf, &statBuf)) {
                is_dir = S_ISDIR(statBuf.st_mode);
index 91453e7c464587847bbae88a73b48304f7533793..3dcf5fb7e7e7c883b40aa9f75681d7143fe33d00 100644 (file)
@@ -730,9 +730,7 @@ static int parse(char *l, int lineno)
                return -1;
        }
        
-       strncpy(m->desc, l, sizeof(m->desc) - 1);
-       m->desc[sizeof(m->desc) - 1] = '\0';
-
+       strlcpy(m->desc, l, sizeof(m->desc));
     return 0;
 }