strcpy => strlcpy, strcat => strlcat
Reported by: Coverity CID: 1006703 978863 1006745 1347163 Reviewed by: cem MFC after: 3 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D10192
This commit is contained in:
parent
db3625531e
commit
9039018c34
@ -1064,8 +1064,8 @@ main(int argc, char *argv[])
|
||||
err(1, "malloc");
|
||||
strcpy(message, *argv);
|
||||
while (*++argv) {
|
||||
strcat(message, " ");
|
||||
strcat(message, *argv);
|
||||
strlcat(message, " ", j);
|
||||
strlcat(message, *argv, j);
|
||||
}
|
||||
nchars = strlen(message);
|
||||
} else {
|
||||
|
@ -303,8 +303,8 @@ getargs(int argc, char **argv)
|
||||
usage();
|
||||
}
|
||||
if (*Outfile == '\0') {
|
||||
strcpy(Outfile, Infile);
|
||||
strcat(Outfile, ".dat");
|
||||
strlcpy(Outfile, Infile, sizeof(Outfile));
|
||||
strlcat(Outfile, ".dat", sizeof(Outfile));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -561,7 +561,7 @@ print_limit(rlim_t limit, unsigned divisor, const char * inf, const char * pfx,
|
||||
char numbr[64];
|
||||
|
||||
if (limit == RLIM_INFINITY)
|
||||
strcpy(numbr, inf);
|
||||
strlcpy(numbr, inf, sizeof(numbr));
|
||||
else
|
||||
sprintf(numbr, "%jd", (intmax_t)((limit + divisor/2) / divisor));
|
||||
printf(pfx, which, numbr);
|
||||
|
@ -856,9 +856,9 @@ rpcbdump(int dumptype, char *netid, int argc, char **argv)
|
||||
printf("%-10s", buf);
|
||||
buf[0] = '\0';
|
||||
for (nl = rs->nlist; nl; nl = nl->next) {
|
||||
strcat(buf, nl->netid);
|
||||
strlcat(buf, nl->netid, sizeof(buf));
|
||||
if (nl->next)
|
||||
strcat(buf, ",");
|
||||
strlcat(buf, ",", sizeof(buf));
|
||||
}
|
||||
printf("%-32s", buf);
|
||||
rpc = getrpcbynumber(rs->prog);
|
||||
|
Loading…
Reference in New Issue
Block a user