mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-27 13:34:00 +01:00
In uuid_ether_add(), avoid false positives due to the limited type
used to hold the sum of the bytes of the MAC address. While here, rename the variable that holds the sum from 'c' to 'sum'. Pointed out by: thompsa@
This commit is contained in:
parent
b9740ba1a8
commit
8ff6ca1e08
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=253615
@ -200,8 +200,7 @@ sys_uuidgen(struct thread *td, struct uuidgen_args *uap)
|
|||||||
int
|
int
|
||||||
uuid_ether_add(const uint8_t *addr)
|
uuid_ether_add(const uint8_t *addr)
|
||||||
{
|
{
|
||||||
int i;
|
int i, sum;
|
||||||
uint8_t c;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Validate input. No multicast addresses and no addresses that
|
* Validate input. No multicast addresses and no addresses that
|
||||||
@ -209,10 +208,10 @@ uuid_ether_add(const uint8_t *addr)
|
|||||||
*/
|
*/
|
||||||
if (addr[0] & 0x01)
|
if (addr[0] & 0x01)
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
c = 0;
|
sum = 0;
|
||||||
for (i = 0; i < UUID_NODE_LEN; i++)
|
for (i = 0; i < UUID_NODE_LEN; i++)
|
||||||
c += addr[i];
|
sum += addr[i];
|
||||||
if (c == 0)
|
if (sum == 0)
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
|
|
||||||
mtx_lock(&uuid_mutex);
|
mtx_lock(&uuid_mutex);
|
||||||
|
Loading…
Reference in New Issue
Block a user