From 2f37c4ddb0412f770bb15e8eb78075741664449d Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Thu, 28 Dec 2006 20:45:36 +0000 Subject: [PATCH] MFH --- ext/fdf/fdf.c | 3 +-- ext/mime_magic/mime_magic.c | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/ext/fdf/fdf.c b/ext/fdf/fdf.c index c323e6b4a0..215f411f84 100644 --- a/ext/fdf/fdf.c +++ b/ext/fdf/fdf.c @@ -1492,8 +1492,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); diff --git a/ext/mime_magic/mime_magic.c b/ext/mime_magic/mime_magic.c index df2d9c3304..0e2b0e0606 100644 --- a/ext/mime_magic/mime_magic.c +++ b/ext/mime_magic/mime_magic.c @@ -651,9 +651,7 @@ static int parse(char *l, int lineno) } else m->nospflag = 0; - strncpy(m->desc, l, sizeof(m->desc) - 1); - m->desc[sizeof(m->desc) - 1] = '\0'; - + strlcpy(m->desc, l, sizeof(m->desc)); return 0; } -- 2.40.0