mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-17 08:40:14 +02:00
util/nvmutil: fix faulty zeroes-mac-address check
it was resetting the total for each nibble. absolute epic fail on my part. fixed now.
This commit is contained in:
@@ -205,7 +205,7 @@ parseMacAddress(const char *strMac, uint16_t *mac)
|
|||||||
int i, nib, byte;
|
int i, nib, byte;
|
||||||
uint8_t val8;
|
uint8_t val8;
|
||||||
uint16_t val16;
|
uint16_t val16;
|
||||||
uint64_t total;
|
uint64_t total = 0;
|
||||||
|
|
||||||
if (strnlen(strMac, 20) != 17)
|
if (strnlen(strMac, 20) != 17)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -215,7 +215,7 @@ parseMacAddress(const char *strMac, uint16_t *mac)
|
|||||||
if (strMac[i + 2] != ':')
|
if (strMac[i + 2] != ':')
|
||||||
return -1;
|
return -1;
|
||||||
byte = i / 3;
|
byte = i / 3;
|
||||||
for (total = 0, nib = 0; nib < 2; nib++, total += val8) {
|
for (nib = 0; nib < 2; nib++, total += val8) {
|
||||||
if ((val8 = hextonum(strMac[i + nib])) > 15)
|
if ((val8 = hextonum(strMac[i + nib])) > 15)
|
||||||
return -1;
|
return -1;
|
||||||
if ((byte == 0) && (nib == 1))
|
if ((byte == 0) && (nib == 1))
|
||||||
|
|||||||
Reference in New Issue
Block a user