svn commit: r323908 - head/sys/boot/efi/libefi

Toomas Soome tsoome at FreeBSD.org
Fri Sep 22 07:40:06 UTC 2017


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


More information about the svn-src-all mailing list