From owner-svn-src-head@freebsd.org Thu Jul 12 16:19:18 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 4C68E1049580; Thu, 12 Jul 2018 16:19:18 +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 ED900712AA; Thu, 12 Jul 2018 16:19:17 +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 CEAF323B92; Thu, 12 Jul 2018 16:19:17 +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 w6CGJHZl036682; Thu, 12 Jul 2018 16:19:17 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6CGJHoj036681; Thu, 12 Jul 2018 16:19:17 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807121619.w6CGJHoj036681@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 12 Jul 2018 16:19:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336220 - head/lib/libefivar X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/lib/libefivar X-SVN-Commit-Revision: 336220 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.27 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: Thu, 12 Jul 2018 16:19:18 -0000 Author: imp Date: Thu Jul 12 16:19:17 2018 New Revision: 336220 URL: https://svnweb.freebsd.org/changeset/base/336220 Log: Fix an obvious 'is odd' check. len % 1 is always true. Fix StrHexToBytes to do a proper odd length check. This was only called by DevPathFromTextGenericPath, ConvertFromTextVendor and DevPathFromTextMAC, which we've not had a need to actually use just yet. Submitted by: David Binderman PR: 229718 Modified: head/lib/libefivar/uefi-dplib.h Modified: head/lib/libefivar/uefi-dplib.h ============================================================================== --- head/lib/libefivar/uefi-dplib.h Thu Jul 12 11:38:18 2018 (r336219) +++ head/lib/libefivar/uefi-dplib.h Thu Jul 12 16:19:17 2018 (r336220) @@ -576,7 +576,7 @@ StrHexToBytes(const char *str, size_t len, uint8_t *bu /* * Sanity check preconditions. */ - if (buflen != len / 2 || (len % 1) == 1) + if (buflen != len / 2 || (len % 2) == 1) return 1; for (i = 0; i < len; i += 2) { if (!isxdigit(str[i]) || !isxdigit(str[i + 1]))