Author: imp Date: Fri Oct 26 22:49:36 2018 New Revision: 339799 URL: https://svnweb.freebsd.org/changeset/base/339799
Log: Ensure that the device path is sane before trying to decode and print it. Sponsored by: Netflix, Inc Modified: head/lib/libefivar/efivar-dp-format.c Modified: head/lib/libefivar/efivar-dp-format.c ============================================================================== --- head/lib/libefivar/efivar-dp-format.c Fri Oct 26 22:49:25 2018 (r339798) +++ head/lib/libefivar/efivar-dp-format.c Fri Oct 26 22:49:36 2018 (r339799) @@ -2413,12 +2413,19 @@ UefiDevicePathLibConvertDevicePathToText ( } } - ssize_t efidp_format_device_path(char *buf, size_t len, const_efidp dp, ssize_t max) { char *str; ssize_t retval; + + /* + * Basic sanity check on the device path. + */ + if (!IsDevicePathValid((CONST EFI_DEVICE_PATH_PROTOCOL *) dp, max)) { + *buf = '\0'; + return 0; + } str = UefiDevicePathLibConvertDevicePathToText ( __DECONST(EFI_DEVICE_PATH_PROTOCOL *, dp), FALSE, TRUE); _______________________________________________ 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"