summaryrefslogtreecommitdiff
path: root/usr.sbin/repquota/repquota.c
diff options
context:
space:
mode:
authorPaul Janzen <pjanzen@cvs.openbsd.org>2000-12-21 09:50:01 +0000
committerPaul Janzen <pjanzen@cvs.openbsd.org>2000-12-21 09:50:01 +0000
commit29a41ab9f3922814d767eb7feb34ad8b81773763 (patch)
tree29f2c7365d4b65ca1a1878f805c65202ef5284e7 /usr.sbin/repquota/repquota.c
parent8bf4e49e0541d798a6ed75f7b708391b332350e4 (diff)
Print quotas > 4G correctly; be a little more paranoid with a few buffers.
Diffstat (limited to 'usr.sbin/repquota/repquota.c')
-rw-r--r--usr.sbin/repquota/repquota.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/usr.sbin/repquota/repquota.c b/usr.sbin/repquota/repquota.c
index 723fa605e81..dd452325b26 100644
--- a/usr.sbin/repquota/repquota.c
+++ b/usr.sbin/repquota/repquota.c
@@ -42,7 +42,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)repquota.c 8.1 (Berkeley) 6/6/93";*/
-static char *rcsid = "$Id: repquota.c,v 1.11 2000/09/11 18:47:29 millert Exp $";
+static char *rcsid = "$Id: repquota.c,v 1.12 2000/12/21 09:50:00 pjanzen Exp $";
#endif /* not lint */
/*
@@ -233,9 +233,12 @@ repquota(fs, type, qfpathname)
fup->fu_dqblk.dqb_isoftlimit &&
fup->fu_dqblk.dqb_curinodes >=
fup->fu_dqblk.dqb_isoftlimit ? '+' : '-',
- dbtob(fup->fu_dqblk.dqb_curblocks) / 1024,
- dbtob(fup->fu_dqblk.dqb_bsoftlimit) / 1024,
- dbtob(fup->fu_dqblk.dqb_bhardlimit) / 1024,
+ (int)(dbtob((u_quad_t)fup->fu_dqblk.dqb_curblocks)
+ / 1024),
+ (int)(dbtob((u_quad_t)fup->fu_dqblk.dqb_bsoftlimit)
+ / 1024),
+ (int)(dbtob((u_quad_t)fup->fu_dqblk.dqb_bhardlimit)
+ / 1024),
fup->fu_dqblk.dqb_bsoftlimit &&
fup->fu_dqblk.dqb_curblocks >=
fup->fu_dqblk.dqb_bsoftlimit ?
@@ -284,11 +287,13 @@ hasquota(fs, type, qfnamep)
static char buf[BUFSIZ];
if (!initname) {
- sprintf(usrname, "%s%s", qfextension[USRQUOTA], qfname);
- sprintf(grpname, "%s%s", qfextension[GRPQUOTA], qfname);
+ (void)snprintf(usrname, sizeof usrname, "%s%s",
+ qfextension[USRQUOTA], qfname);
+ (void)snprintf(grpname, sizeof grpname, "%s%s",
+ qfextension[GRPQUOTA], qfname);
initname = 1;
}
- strcpy(buf, fs->fs_mntops);
+ strlcpy(buf, fs->fs_mntops, sizeof buf);
for (opt = strtok(buf, ","); opt; opt = strtok(NULL, ",")) {
if ((cp = strchr(opt, '=')))
*cp++ = '\0';
@@ -303,7 +308,8 @@ hasquota(fs, type, qfnamep)
*qfnamep = cp;
return (1);
}
- (void) sprintf(buf, "%s/%s.%s", fs->fs_file, qfname, qfextension[type]);
+ (void)snprintf(buf, sizeof buf, "%s/%s.%s",
+ fs->fs_file, qfname, qfextension[type]);
*qfnamep = buf;
return (1);
}