The comparison was not working properly and the line of code was a little
bit obfuscated.
static bool Alias_MatchIpv4(struct AliasItemStruct *alias,unsigned char *ipv4)
{
int len;
+ int n,m;
len=alias->Ipv4.NBits;
- if ((len<8 || memcmp(ipv4,alias->Ipv4.Ip,len/8)==0) && ((len%8)==0 || (ipv4[len/8] ^ alias->Ipv4.Ip[len/8]) & (0xFFU<<(8-len%8)))==0) {
- return(true);
- }
- return(false);
+ n=len/8;
+ m=len%8;
+ if (n>0 && memcmp(ipv4,alias->Ipv4.Ip,n)!=0) return(false);
+ if (m!=0 && (ipv4[n] ^ alias->Ipv4.Ip[n]) & (0xFFU<<(8-m))!=0) return(false);
+ return(true);
}
/*!