Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Sep 2017 07:40:05 +0000 (UTC)
From:      Toomas Soome <tsoome@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r323908 - head/sys/boot/efi/libefi
Message-ID:  <201709220740.v8M7e5EJ005647@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tsoome
Date: Fri Sep 22 07:40:05 2017
New Revision: 323908
URL: https://svnweb.freebsd.org/changeset/base/323908

Log:
  libefi: efipart_hdinfo_add_filepath should check strtol result
  
  Use errno for error checking.

Modified:
  head/sys/boot/efi/libefi/efipart.c

Modified: head/sys/boot/efi/libefi/efipart.c
==============================================================================
--- head/sys/boot/efi/libefi/efipart.c	Fri Sep 22 07:37:42 2017	(r323907)
+++ head/sys/boot/efi/libefi/efipart.c	Fri Sep 22 07:40:05 2017	(r323908)
@@ -489,7 +489,14 @@ efipart_hdinfo_add_filepath(EFI_HANDLE disk_handle)
 		return (0);
 	}
 	p++;	/* skip the colon */
+	errno = 0;
 	unit = (int)strtol(p, NULL, 0);
+	if (errno != 0) {
+		printf("Bad unit number for partition \"%s\"\n", pathname);
+		free(pathname);
+		free(pd);
+		return (EUNIT);
+	}
 
 	/*
 	 * We should have disk registered, if not, we are receiving



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