I think my code has beaten the compiler.

opt->source_netmask  will remain set to zero on any code path which
doesn't set addrp and inhibit the execution of the memcpy()

Nevertheless I'll add a check, it took me 10 minutes to conince myself
the able was true.

Cheers,

Simon.

On 21/05/17 11:49, Matthias Andree wrote:
> Am 20.05.2017 um 22:50 schrieb Simon Kelley:
>> I've just mase the fourth, and probably final, release candidate for
>> dnsmasq-27. Please download, compile and run, and report any problems
>> ASAP. If all looks OK, 2.77 will happen in the next week.
>>
>> http://www.thekelleys.org.uk/dnsmasq/release-candidates/dnsmasq-2.77rc4.tar.gz
>>
> 
> GCC 5 and 6 also have this complaint, and they are right, unless you
> prove that the address family is either AF_INET or AF_INET6.
> If the latter isn't true, memcpy() copies to whichever garbage address
> was in the stack and picked up by [auto] void *addrp.
> 
> edns0.c: In function 'calc_subnet_opt':
> edns0.c:350:7: warning: 'addrp' may be used uninitialized in this
> function [-Wmaybe-uninitialized]
>        memcpy(opt->addr, addrp, len);
>        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Cheers,
> Matthias
> 
> 
> 
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss@lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
> 


Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss

Reply via email to