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:
parent
c608a9a591
commit
d7c881e895
@ -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]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user