[Dnsmasq-discuss] [PATCH] ipset: fix incorrect length passed to memset

Simon Kelley simon at thekelleys.org.uk
Thu Apr 18 21:05:25 BST 2013


On 18/04/13 18:27, Dave Reisner wrote:
> On Thu, Apr 18, 2013 at 09:49:49AM +0100, Simon Kelley wrote:
>> On 17/04/13 20:48, Dave Reisner wrote:
>>> Exposed by a gcc compiler warning:
>>>
>>> ipset.c:113:27: warning: argument to 'sizeof' in 'memset' call is the
>>> same expression as the destination; did you mean to provide an explicit
>>> length? [-Wsizeof-pointer-memaccess]
>>>     memset(buffer, 0, sizeof(buffer));
>>> ---
>>>   src/ipset.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/src/ipset.c b/src/ipset.c
>>> index a34ed96..f175fa4 100644
>>> --- a/src/ipset.c
>>> +++ b/src/ipset.c
>>> @@ -110,7 +110,7 @@ static int new_add_to_ipset(const char *setname, const struct all_addr *ipaddr,
>>>         return -1;
>>>       }
>>>
>>> -  memset(buffer, 0, sizeof(buffer));
>>> +  memset(buffer, 0, BUFF_SZ);
>>>
>>>     nlh = (struct nlmsghdr *)buffer;
>>>     nlh->nlmsg_len = NL_ALIGN(sizeof(struct nlmsghdr));
>>>
>>
>>
>> OK, you get the prize for the first bug in the new release. Many thanks.
>>
>>
>> Cheers,
>>
>> Simon.
>
> Thanks for the quick turnaround. I'm somewhat unfamiliar with dnsmasq
> development, so I'm a little confused as to why you recomitted my fix
> without my name on it. The patch I sent was nicely formatted for 'git
> am' application. Was there something I omitted?
>
> Cheers,
> Dave
>

Apologies, I was working remotely, opened an editor on the file to look 
at the fix in context, and it was easier to re-edit the change than 
apply the patch directly. You're explicitly credited in the git commit 
changelog, but I omitted the --author argument. I've fixed that now.

Cheers,

Simon.




More information about the Dnsmasq-discuss mailing list