Date: Fri, 26 Oct 2018 22:49:36 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r339799 - head/lib/libefivar Message-ID: <201810262249.w9QMnaKZ045199@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201810262249.w9QMnaKZ045199>