summaryrefslogtreecommitdiff
path: root/usr.bin/quota/quota.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-07-10 08:17:40 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-07-10 08:17:40 +0000
commit1822c24019aeec2c80c7e931d3681a6100d6a726 (patch)
tree7066d1fea320b231910ed628cb62117f5799c473 /usr.bin/quota/quota.c
parentde81fe773f9f41a5f3b47ce63ea5197aed965c43 (diff)
avoid buf oflows
Diffstat (limited to 'usr.bin/quota/quota.c')
-rw-r--r--usr.bin/quota/quota.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/usr.bin/quota/quota.c b/usr.bin/quota/quota.c
index 617f7f14f7f..5a6133104cc 100644
--- a/usr.bin/quota/quota.c
+++ b/usr.bin/quota/quota.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: quota.c,v 1.9 1997/01/17 07:13:08 millert Exp $ */
+/* $OpenBSD: quota.c,v 1.10 1998/07/10 08:17:39 deraadt Exp $ */
/*
* Copyright (c) 1980, 1990, 1993
@@ -44,7 +44,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)quota.c 8.1 (Berkeley) 6/6/93";*/
-static char rcsid[] = "$OpenBSD: quota.c,v 1.9 1997/01/17 07:13:08 millert Exp $";
+static char rcsid[] = "$OpenBSD: quota.c,v 1.10 1998/07/10 08:17:39 deraadt Exp $";
#endif /* not lint */
/*
@@ -411,14 +411,14 @@ timeprt(seconds)
minutes = (seconds + 30) / 60;
hours = (minutes + 30) / 60;
if (hours >= 36) {
- sprintf(buf, "%ddays", (hours + 12) / 24);
+ snprintf(buf, sizeof buf, "%ddays", (hours + 12) / 24);
return (buf);
}
if (minutes >= 60) {
- sprintf(buf, "%2d:%d", minutes / 60, minutes % 60);
+ snprintf(buf, sizeof buf, "%2d:%d", minutes / 60, minutes % 60);
return (buf);
}
- sprintf(buf, "%2d", minutes);
+ snprintf(buf, sizeof buf, "%2d", minutes);
return (buf);
}
@@ -471,7 +471,8 @@ getprivs(id, quotatype)
continue;
} else
continue;
- strcpy(qup->fsname, fst[i].f_mntonname);
+ strncpy(qup->fsname, fst[i].f_mntonname, sizeof qup->fsname-1);
+ qup->fsname[sizeof qup->fsname-1] = '\0';
if (quphead == NULL)
quphead = qup;
else