From 534e452760f3e33c847df924fd461273d9cd8707 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Thu, 14 Apr 2005 22:21:25 +0000 Subject: fix off-by-ones in path truncation checks. from Han Boetes; ok deraadt@ --- usr.sbin/kvm_mkdb/kvm_mkdb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'usr.sbin/kvm_mkdb/kvm_mkdb.c') 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); } -- cgit v1.2.3