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

index e991d4cf3423e892b598c120843165d444023b81..81c23bd34b3f481a4a1391f0a60918a24b260cf9 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 c4a4ebaf24477525200818e2a04076b6f7e54c0c..7760efe094bdb9b159a82e34f9c7e961ecbe9161 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;
 }