From ba85f103e59db924f4dfba7de56bcba8ae311e3c Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 17 Apr 2008 17:39:08 +0300 Subject: [PATCH] Use rstrlcpy() for printFileInfo() username + group fields - just avoids having to manually ensure zero-termination --- lib/query.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/query.c b/lib/query.c index d642c80..f118aba 100644 --- a/lib/query.c +++ b/lib/query.c @@ -50,11 +50,8 @@ static void printFileInfo(const char * name, if (tm) nowtm = *tm; /* structure assignment */ } - strncpy(ownerfield, owner, sizeof(ownerfield)); - ownerfield[sizeof(ownerfield)-1] = '\0'; - - strncpy(groupfield, group, sizeof(groupfield)); - groupfield[sizeof(groupfield)-1] = '\0'; + rstrlcpy(ownerfield, owner, sizeof(ownerfield)); + rstrlcpy(groupfield, group, sizeof(groupfield)); /* this is normally right */ sprintf(sizefield, "%12u", size); -- 2.7.4