Prefer strlcpy to strncpy. In one case, this saves us from re-zeroing

data that's alreday 0.  In another, it saves us from zeroing data that
will be overwritten again.
This commit is contained in:
Warner Losh 2006-08-20 06:32:40 +00:00
parent c608a9a591
commit d7c881e895
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=161470

View File

@ -113,7 +113,7 @@ main(int argc, char *argv[])
memset(&totalbuf, 0, sizeof(totalbuf));
totalbuf.f_bsize = DEV_BSIZE;
strncpy(totalbuf.f_mntfromname, "total", MNAMELEN);
strlcpy(totalbuf.f_mntfromname, "total", MNAMELEN);
vfslist = NULL;
while ((ch = getopt(argc, argv, "abcgHhiklmnPt:")) != -1)
switch (ch) {
@ -552,7 +552,7 @@ makenetvfslist(void)
*str = 'n'; *(str + 1) = 'o';
for (i = 0, strptr = str + 2; i < cnt; i++, strptr++) {
strncpy(strptr, listptr[i], 32);
strlcpy(strptr, listptr[i], 32);
strptr += strlen(listptr[i]);
*strptr = ',';
free(listptr[i]);