Fix a bug in handling prefixlengths that are not a multiple of 4.
Thanks to Sven-Haegar Koch for spotting the bug and providing the fix.
This commit is contained in:
parent
af95368c0f
commit
8ebb017a10
2 changed files with 3 additions and 2 deletions
1
THANKS
1
THANKS
|
@ -24,6 +24,7 @@ We would like to thank the following people for their contributions to tinc:
|
|||
* Paul Littlefield
|
||||
* Robert van der Meulen
|
||||
* Scott Lamb
|
||||
* Sven-Haegar Koch
|
||||
* Teemu Kiviniemi
|
||||
* Tonnerre Lombard
|
||||
* Wessel Dankers
|
||||
|
|
|
@ -257,7 +257,7 @@ void mask(void *va, int masklen, int len)
|
|||
masklen %= 8;
|
||||
|
||||
if(masklen)
|
||||
a[i++] &= (0x100 - (1 << masklen));
|
||||
a[i++] &= (0x100 - (1 << (8 - masklen)));
|
||||
|
||||
for(; i < len; i++)
|
||||
a[i] = 0;
|
||||
|
@ -275,7 +275,7 @@ void maskcpy(void *va, const void *vb, int masklen, int len)
|
|||
a[i] = b[i];
|
||||
|
||||
if(m) {
|
||||
a[i] = b[i] & (0x100 - (1 << m));
|
||||
a[i] = b[i] & (0x100 - (1 << (8 - m)));
|
||||
i++;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue