From owner-svn-src-head@freebsd.org Fri Oct 26 22:49:26 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 1081610CB94F; Fri, 26 Oct 2018 22:49:26 +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 BAFEE6E6AF; Fri, 26 Oct 2018 22:49:25 +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 9D74F27412; Fri, 26 Oct 2018 22:49:25 +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 w9QMnPkp045146; Fri, 26 Oct 2018 22:49:25 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9QMnPkc045145; Fri, 26 Oct 2018 22:49:25 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201810262249.w9QMnPkc045145@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:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r339798 - head/usr.sbin/efivar X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/usr.sbin/efivar X-SVN-Commit-Revision: 339798 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:26 -0000 Author: imp Date: Fri Oct 26 22:49:25 2018 New Revision: 339798 URL: https://svnweb.freebsd.org/changeset/base/339798 Log: Require that we have at least a device path header before trying to decode the next device path. Sponsored by: Netflix, Inc Modified: head/usr.sbin/efivar/efiutil.c Modified: head/usr.sbin/efivar/efiutil.c ============================================================================== --- head/usr.sbin/efivar/efiutil.c Fri Oct 26 22:13:40 2018 (r339797) +++ head/usr.sbin/efivar/efiutil.c Fri Oct 26 22:49:25 2018 (r339798) @@ -159,7 +159,7 @@ efi_print_load_option(uint8_t *data, size_t datalen, i ucs2_to_utf8(descr, &str); printf("%s", str); free(str); - while (dp < edp) { + while (dp < edp && (size_t)(edp - dp) > sizeof(efidp_header)) { efidp_format_device_path(buf, sizeof(buf), dp, (intptr_t)(void *)edp - (intptr_t)(void *)dp); dp = (efidp)((char *)dp + efidp_size(dp));