From 72846fc11e80432d816c246b0dcb0e27716aabd5 Mon Sep 17 00:00:00 2001 From: bjh21 Date: Thu, 8 Jan 2009 22:26:19 +0000 Subject: [PATCH] If the user specifies a cd9660-specific option that needs an integer value without supplying a value, complain at them instead of segfaulting. Or, to put it another way, check that the value is non-NULL before calling set_option(). --- usr.sbin/makefs/cd9660.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/usr.sbin/makefs/cd9660.c b/usr.sbin/makefs/cd9660.c index f40d4de78949..26f06b89943b 100644 --- a/usr.sbin/makefs/cd9660.c +++ b/usr.sbin/makefs/cd9660.c @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660.c,v 1.23 2008/11/21 10:02:12 ad Exp $ */ +/* $NetBSD: cd9660.c,v 1.24 2009/01/08 22:26:19 bjh21 Exp $ */ /* * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan @@ -103,7 +103,7 @@ #include #if defined(__RCSID) && !defined(__lint) -__RCSID("$NetBSD: cd9660.c,v 1.23 2008/11/21 10:02:12 ad Exp $"); +__RCSID("$NetBSD: cd9660.c,v 1.24 2009/01/08 22:26:19 bjh21 Exp $"); #endif /* !__lint */ #include @@ -421,8 +421,13 @@ cd9660_parse_opts(const char *option, fsinfo_t *fsopts) } else { cd9660_eltorito_add_boot_option(var, val); } - } else - rv = set_option(cd9660_options, var, val); + } else { + if (val == NULL) { + warnx("Option `%s' doesn't contain a value", var); + rv = 0; + } else + rv = set_option(cd9660_options, var, val); + } if (var) free(var);