Re: libxt_rateest: fix segfault

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

 



On Tuesday 2008-12-09 15:05, Patrick McHardy wrote:
> Jan Engelhardt wrote:
>> When running `ip6tables -m rateest` without any other arguments,
>> rateest did segfault.
>> ---
>>  extensions/libxt_rateest.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>> 
>> diff --git a/extensions/libxt_rateest.c b/extensions/libxt_rateest.c
>> index ebea437..f0dd577 100644
>> --- a/extensions/libxt_rateest.c
>> +++ b/extensions/libxt_rateest.c
>> @@ -306,7 +306,7 @@ rateest_final_check(unsigned int flags)
>>  {
>>   struct xt_rateest_match_info *info = rateest_info;
>> 
>> -	if (!(info->flags & XT_RATEEST_MATCH_REL))
>> +	if (info != NULL && !(info->flags & XT_RATEEST_MATCH_REL))
>>    info->flags |= XT_RATEEST_MATCH_ABS;
>
> I think we should print an error message instead. The kernel will
> refuse it anyways.

parent cea9f71f5618250a38acb21c31fbbf93a752f7d4
commit e2ac8eed9cd24bfabedb931c854ab7e0c9de5fd1
Author: Jan Engelhardt <jengelh@xxxxxxxxxx>
Date:   Wed Dec 24 20:15:44 2008 +0100

rateest: guard against segfault

Signed-off-by: Jan Engelhardt <jengelh@xxxxxxxxxx>
---
 extensions/libxt_rateest.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/extensions/libxt_rateest.c b/extensions/libxt_rateest.c
index ebea437..333239d 100644
--- a/extensions/libxt_rateest.c
+++ b/extensions/libxt_rateest.c
@@ -306,6 +306,9 @@ rateest_final_check(unsigned int flags)
 {
 	struct xt_rateest_match_info *info = rateest_info;
 
+	if (info == NULL)
+		exit_error(PARAMETER_PROBLEM, "rateest match: "
+		           "you need to specify some flags");
 	if (!(info->flags & XT_RATEEST_MATCH_REL))
 		info->flags |= XT_RATEEST_MATCH_ABS;
 }
--
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