Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Nov 2015 09:22:12 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r290595 - stable/10/usr.sbin/makefs
Message-ID:  <201511090922.tA99MC9n017159@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Mon Nov  9 09:22:11 2015
New Revision: 290595
URL: https://svnweb.freebsd.org/changeset/base/290595

Log:
  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

Modified:
  stable/10/usr.sbin/makefs/cd9660.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/makefs/cd9660.c
==============================================================================
--- stable/10/usr.sbin/makefs/cd9660.c	Mon Nov  9 09:20:01 2015	(r290594)
+++ stable/10/usr.sbin/makefs/cd9660.c	Mon Nov  9 09:22:11 2015	(r290595)
@@ -296,8 +296,8 @@ cd9660_parse_opts(const char *option, fs
 	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,
 	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 cha
 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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511090922.tA99MC9n017159>