summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1996-12-07 10:09:24 +0000
committerderaadt <deraadt@openbsd.org>1996-12-07 10:09:24 +0000
commitbf01d7474a9918e8b534e0bc5545e739fd3c404c (patch)
tree5992f1f65b9539b0ad50a8fbd99f5cf4d59b3cca
parentavoid race, avoid mbuf leak (diff)
downloadwireguard-openbsd-bf01d7474a9918e8b534e0bc5545e739fd3c404c.tar.xz
wireguard-openbsd-bf01d7474a9918e8b534e0bc5545e739fd3c404c.zip
correct a sigsegv during parsing of garbled input; netbsd pr#2659, dgilbert@jaywon.pci.on.ca
-rw-r--r--sbin/disklabel/disklabel.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c
index b1940ae63d8..283c50f390d 100644
--- a/sbin/disklabel/disklabel.c
+++ b/sbin/disklabel/disklabel.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disklabel.c,v 1.24 1996/11/12 07:04:49 downsj Exp $ */
+/* $OpenBSD: disklabel.c,v 1.25 1996/12/07 10:09:24 deraadt Exp $ */
/* $NetBSD: disklabel.c,v 1.30 1996/03/14 19:49:24 ghudson Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#endif /* not lint */
#ifndef lint
-static char rcsid[] = "$OpenBSD: disklabel.c,v 1.24 1996/11/12 07:04:49 downsj Exp $";
+static char rcsid[] = "$OpenBSD: disklabel.c,v 1.25 1996/12/07 10:09:24 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -1266,6 +1266,10 @@ getasciilabel(f, lp)
errors++;
} else
pp->p_offset = v;
+ if (tp == NULL) {
+ pp->p_fstype = FS_UNUSED;
+ goto gottype;
+ }
cp = tp, tp = word(cp);
cpp = fstypenames;
for (; cpp < &fstypenames[FSMAXTYPES]; cpp++)
@@ -1287,6 +1291,8 @@ getasciilabel(f, lp)
switch (pp->p_fstype) {
case FS_UNUSED: /* XXX */
+ if (tp == NULL) /* ok to skip fsize/bsize */
+ break;
NXTNUM(pp->p_fsize);
if (pp->p_fsize == 0)
break;