From 032cc47f8b96354fc6f05112408f79bb76dbfc51 Mon Sep 17 00:00:00 2001 From: krw <> Date: Mon, 2 Oct 2006 12:01:40 +0000 Subject: [PATCH] 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@ --- src/lib/libutil/readlabel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/libutil/readlabel.c b/src/lib/libutil/readlabel.c index 60445749..acb3699c 100644 --- a/src/lib/libutil/readlabel.c +++ b/src/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);