mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-27 08:00:11 +00:00
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
This commit is contained in:
parent
0a2c13d333
commit
03307d7ac3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=336220
@ -576,7 +576,7 @@ StrHexToBytes(const char *str, size_t len, uint8_t *buf, size_t buflen)
|
||||
/*
|
||||
* 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]))
|
||||
|
Loading…
Reference in New Issue
Block a user