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)
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to