svn commit: r368200 - head/usr.sbin/efibootmgr

Mitchell Horne mhorne at FreeBSD.org
Mon Nov 30 22:16:12 UTC 2020


Author: mhorne
Date: Mon Nov 30 22:16:11 2020
New Revision: 368200
URL: https://svnweb.freebsd.org/changeset/base/368200

Log:
  efibootmgr: fix an incorrect error handling check
  
  efivar_device_path_to_unix_path() returns standard error codes on
  failure and zero on success. Checking for a return value less than zero
  means that the actual failure cases won't be handled. This could
  manifest as a segfault during the subsequent call to printf().
  
  Reviewed by:	imp
  MFC after:	3 days
  Differential Revision:	https://reviews.freebsd.org/D27424

Modified:
  head/usr.sbin/efibootmgr/efibootmgr.c

Modified: head/usr.sbin/efibootmgr/efibootmgr.c
==============================================================================
--- head/usr.sbin/efibootmgr/efibootmgr.c	Mon Nov 30 21:59:52 2020	(r368199)
+++ head/usr.sbin/efibootmgr/efibootmgr.c	Mon Nov 30 22:16:11 2020	(r368200)
@@ -1034,7 +1034,7 @@ report_esp_device(bool do_dp, bool do_unix)
 		printf("%s\n", buf);
 		exit(0);
 	}
-	if (efivar_device_path_to_unix_path(dp, &dev, &relpath, &abspath) < 0)
+	if (efivar_device_path_to_unix_path(dp, &dev, &relpath, &abspath) != 0)
 		errx(1, "Can't convert to unix path");
 	if (do_unix) {
 		if (abspath == NULL)


More information about the svn-src-all mailing list