summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2005-04-14 22:21:25 +0000
committerDamien Miller <djm@cvs.openbsd.org>2005-04-14 22:21:25 +0000
commit534e452760f3e33c847df924fd461273d9cd8707 (patch)
tree8504584c45ad38e37e64c1c4cac77d6877b8996b /usr.sbin
parent994cb8839e7244de556e8fe53247392b0ed6cdfc (diff)
fix off-by-ones in path truncation checks. from Han Boetes; ok deraadt@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/kvm_mkdb/kvm_mkdb.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/kvm_mkdb/kvm_mkdb.c b/usr.sbin/kvm_mkdb/kvm_mkdb.c
index 83d45362ef6..cb412cb5ed4 100644
--- a/usr.sbin/kvm_mkdb/kvm_mkdb.c
+++ b/usr.sbin/kvm_mkdb/kvm_mkdb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kvm_mkdb.c,v 1.15 2003/11/21 09:11:25 djm Exp $ */
+/* $OpenBSD: kvm_mkdb.c,v 1.16 2005/04/14 22:21:24 djm Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -39,7 +39,7 @@ static const char copyright[] =
#if 0
static char sccsid[] = "from: @(#)kvm_mkdb.c 8.3 (Berkeley) 5/4/95";
#else
-static const char rcsid[] = "$OpenBSD: kvm_mkdb.c,v 1.15 2003/11/21 09:11:25 djm Exp $";
+static const char rcsid[] = "$OpenBSD: kvm_mkdb.c,v 1.16 2005/04/14 22:21:24 djm Exp $";
#endif
#endif /* not lint */
@@ -148,13 +148,13 @@ kvm_mkdb(int fd, const char *dbdir, char *nlistpath, char *nlistname,
r = snprintf(dbtemp, sizeof(dbtemp), "%skvm_%s.tmp",
dbdir, nlistname);
- if (r < 0 || r > sizeof(dbtemp)) {
+ if (r < 0 || r >= sizeof(dbtemp)) {
warnx("Directory name too long");
return (1);
}
r = snprintf(dbname, sizeof(dbname), "%skvm_%s.db",
dbdir, nlistname);
- if (r < 0 || r > sizeof(dbtemp)) {
+ if (r < 0 || r >= sizeof(dbtemp)) {
warnx("Directory name too long");
return (1);
}