Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Jul 2018 16:19:17 +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: r336220 - head/lib/libefivar
Message-ID:  <201807121619.w6CGJHoj036681@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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]))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201807121619.w6CGJHoj036681>