Re: [PATCH xt-addons] xt_geoip: fix possible out-of-bounds access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sunday 2010-06-13 10:38, Florian Westphal wrote:
>> diff --git a/extensions/xt_geoip.c b/extensions/xt_geoip.c
>> index 4c6b29f..44e489d 100644
>> --- a/extensions/xt_geoip.c
>> +++ b/extensions/xt_geoip.c
>> @@ -126,13 +126,13 @@ static bool geoip_bsearch(const struct geoip_subnet *range,
>>  {
>>  	int mid;
>>  
>> -	if (hi < lo)
>> +	if (hi <= lo)
>>  		return false;
>>  	mid = (lo + hi) / 2;
>>  	if (range[mid].begin <= addr && addr <= range[mid].end)
>>  		return true;
>>  	if (range[mid].begin > addr)
>> -		return geoip_bsearch(range, addr, lo, mid - 1);
>> +		return geoip_bsearch(range, addr, lo, mid);
>>  	else if (range[mid].end < addr)
>>  		return geoip_bsearch(range, addr, mid + 1, hi);
>>  
>> Seems to work on paper.
>
>Yes, this works as well.
>
>I do not have a strong preference on how this is fixed; if you
>consider your patch to be the better choice then please, by all means,
>apply it :-)

The initial call is
	geoip_bsearch(x, ip, 0, count);
which already shows that the original intent was to make hi
the exclusive upper barrier.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux