mirror of
https://git.openafs.org/openafs.git
synced 2025-01-19 15:30:14 +00:00
libadmin/vos/vosutils.c: mask out sign-extension
Right-shifting a signed int by 24 bits can produce a value outside of 0..0xff due to sign-extension. As a result, in AddressMatch(), the first bPattern!=255 check can never succeed. Fix by masking with 255 before comparison. Change-Id: Idb0b4c176ff120c7cf0e03a935ebfdca51084bbd Reviewed-on: http://gerrit.openafs.org/8884 Reviewed-by: Derrick Brashear <shadow@your-file-system.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com> Tested-by: BuildBot <buildbot@rampaginggeek.com>
This commit is contained in:
parent
bd850e5b98
commit
8e8e3c26b8
@ -568,8 +568,8 @@ AddressMatch(int addrTest, int addrPattern)
|
||||
int bPattern;
|
||||
|
||||
/* Test the high byte */
|
||||
bTest = addrTest >> 24;
|
||||
bPattern = addrPattern >> 24;
|
||||
bTest = (addrTest >> 24) & 255;
|
||||
bPattern = (addrPattern >> 24) & 255;
|
||||
if ((bTest != bPattern) && (bPattern != 255)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user