Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Nov 2020 22:16:11 +0000 (UTC)
From:      Mitchell Horne <mhorne@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r368200 - head/usr.sbin/efibootmgr
Message-ID:  <202011302216.0AUMGBVW079192@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)



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