Browse Source

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@
OPENBSD_4_1
krw 18 years ago
parent
commit
032cc47f8b
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      src/lib/libutil/readlabel.c

+ 2
- 2
src/lib/libutil/readlabel.c View File

@ -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. * Copyright (c) 1996, Jason Downs. All rights reserved.
@ -113,7 +113,7 @@ readlabelfs(char *device, int verbose)
} }
close(fd); close(fd);
if (dk.d_partitions[part - 'a'].p_fstype > FSMAXTYPES) {
if (dk.d_partitions[part - 'a'].p_fstype >= FSMAXTYPES) {
if (verbose) if (verbose)
warnx("%s: bad filesystem type in label", rpath); warnx("%s: bad filesystem type in label", rpath);
return (NULL); return (NULL);


Loading…
Cancel
Save