summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2015-11-09 09:22:11 +0000
committerngie <ngie@FreeBSD.org>2015-11-09 09:22:11 +0000
commit3142453fa3622a1cad6c02558cfa416887cb0ce9 (patch)
treed95fd90c7d9f84335d99968b258a0572d8d35276 /usr.sbin
parentb57d6dcae3729ccf1fe7cfe7704e1b09f747c6bc (diff)
downloadFreeBSD-src-3142453fa3622a1cad6c02558cfa416887cb0ce9.zip
FreeBSD-src-3142453fa3622a1cad6c02558cfa416887cb0ce9.tar.gz
MFC r290264:
Limit isoLevel to 1 and 2 to avoid segfaulting when isoLevel is set to 3 by dereferencing a NULL function pointer Add some asserts to ensure that isolevel is always either 1 or 2. PR: 203645 Reported by: Thomas Schmitt <scdbackup@gmx.net> Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/makefs/cd9660.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/makefs/cd9660.c b/usr.sbin/makefs/cd9660.c
index ea4ed44..dcee66f 100644
--- a/usr.sbin/makefs/cd9660.c
+++ b/usr.sbin/makefs/cd9660.c
@@ -296,8 +296,8 @@ cd9660_parse_opts(const char *option, fsinfo_t *fsopts)
int rv;
/* Set up allowed options - integer options ONLY */
option_t cd9660_options[] = {
- { "l", &diskStructure.isoLevel, 1, 3, "ISO Level" },
- { "isolevel", &diskStructure.isoLevel, 1, 3, "ISO Level" },
+ { "l", &diskStructure.isoLevel, 1, 2, "ISO Level" },
+ { "isolevel", &diskStructure.isoLevel, 1, 2, "ISO Level" },
{ "verbose", &diskStructure.verbose_level, 0, 2,
"Turns on verbose output" },
{ "v", &diskStructure.verbose_level, 0 , 2,
@@ -1055,6 +1055,7 @@ cd9660_rename_filename(cd9660node *iter, int num, int delete_chars)
if (diskStructure.verbose_level > 0)
printf("Rename_filename called\n");
+ assert(1 <= diskStructure.isoLevel && diskStructure.isoLevel <= 2);
/* TODO : A LOT of chanes regarding 8.3 filenames */
if (diskStructure.isoLevel == 1)
maxlength = 8;
@@ -1730,6 +1731,7 @@ cd9660_joliet_convert_filename(const char *oldname, char *newname, int is_file)
static int
cd9660_convert_filename(const char *oldname, char *newname, int is_file)
{
+ assert(1 <= diskStructure.isoLevel && diskStructure.isoLevel <= 2);
/* NEW */
cd9660_filename_conversion_functor conversion_function = 0;
if (diskStructure.isoLevel == 1)
OpenPOWER on IntegriCloud