From owner-svn-src-head@freebsd.org Fri Oct 26 22:49:39 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1397C10CB988; Fri, 26 Oct 2018 22:49:39 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 789E56E7A4; Fri, 26 Oct 2018 22:49:38 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD13D27413; Fri, 26 Oct 2018 22:49:36 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9QMna58045200; Fri, 26 Oct 2018 22:49:36 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9QMnaKZ045199; Fri, 26 Oct 2018 22:49:36 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201810262249.w9QMnaKZ045199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 26 Oct 2018 22:49:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r339799 - head/lib/libefivar X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/lib/libefivar X-SVN-Commit-Revision: 339799 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Oct 2018 22:49:39 -0000 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);