From a7583d5e274608fc59de9d0a30f43dde1ef34df5 Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Mon, 2 Oct 2006 12:01:41 +0000 Subject: Fix off by one comparison. FSMAXTYPES is the last valid index into fstypesnames[], but that entry is NULL. The last valid file system name is at fstypesnames[FSMAXTYPES-1]. Encountered and diagnosed by pedro@. ok pedro@ deraadt@ --- lib/libutil/readlabel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/libutil/readlabel.c b/lib/libutil/readlabel.c index 6044574967f..acb3699c48d 100644 --- a/lib/libutil/readlabel.c +++ b/lib/libutil/readlabel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: readlabel.c,v 1.9 2004/09/18 19:24:14 deraadt Exp $ */ +/* $OpenBSD: readlabel.c,v 1.10 2006/10/02 12:01:40 krw Exp $ */ /* * Copyright (c) 1996, Jason Downs. All rights reserved. @@ -113,7 +113,7 @@ readlabelfs(char *device, int verbose) } close(fd); - if (dk.d_partitions[part - 'a'].p_fstype > FSMAXTYPES) { + if (dk.d_partitions[part - 'a'].p_fstype >= FSMAXTYPES) { if (verbose) warnx("%s: bad filesystem type in label", rpath); return (NULL); -- cgit v1.2.3