diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-04-02 20:30:10 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-04-02 20:30:10 +0000 |
commit | 227a63abf6365e2a71a51c7b0f068093ea8cbcaa (patch) | |
tree | 5a5bbe735984530188987bf87ef2f5ccf590142d /usr.sbin | |
parent | afc0caa2f2f245982c85c9a367868e151de532cd (diff) |
strlcpy; millert ok
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/edquota/edquota.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/edquota/edquota.c b/usr.sbin/edquota/edquota.c index dfc093cc9ef..5e56953e9f1 100644 --- a/usr.sbin/edquota/edquota.c +++ b/usr.sbin/edquota/edquota.c @@ -42,7 +42,7 @@ static char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)edquota.c 8.1 (Berkeley) 6/6/93";*/ -static char *rcsid = "$Id: edquota.c,v 1.36 2003/03/13 09:09:46 deraadt Exp $"; +static char *rcsid = "$Id: edquota.c,v 1.37 2003/04/02 20:30:09 deraadt Exp $"; #endif /* not lint */ /* @@ -251,6 +251,7 @@ getprivs(id, quotatype) u_int mid; char *qfpathname; static int warned = 0; + size_t qfpathnamelen; setfsent(); quphead = (struct quotause *)0; @@ -262,7 +263,8 @@ getprivs(id, quotatype) continue; if (!hasquota(fs, quotatype, &qfpathname)) continue; - qupsize = sizeof(*qup) + strlen(qfpathname); + qfpathnamelen = strlen(qfpathname); + qupsize = sizeof(*qup) + qfpathnamelen; if ((qup = (struct quotause *)malloc(qupsize)) == NULL) errx(2, "out of memory"); if (quotactl(fs->fs_file, qcmd, id, (char *)&qup->dqblk) != 0) { @@ -313,8 +315,8 @@ getprivs(id, quotatype) } close(fd); } - strcpy(qup->qfname, qfpathname); - strcpy(qup->fsname, fs->fs_file); + strlcpy(qup->qfname, qfpathname, qfpathnamelen + 1); + strlcpy(qup->fsname, fs->fs_file, sizeof qup->fsname); if (quphead == NULL) quphead = qup; else |