[Dnsmasq-discuss] [PATCH] Various fixes detected by static analysis
Petr Mensik
pemensik at redhat.com
Tue Aug 21 21:22:25 BST 2018
Hi Simon and all others,
I have tried running dnsmasq under coverity, static analysis tool. It
found some warnings. I have fixed some things. Most obvious error was
inconsistent handling of buffer length of interface names. Buffer size
is IFNAMSIZ long, that is 16 bytes. But if interface should have
terminating zero, max. useable length is 15. Sometimes, buffer size is
16+1, sometimes only 16. Sometimes name might be sent to the kernel
unterminated. According to [1] it cannot be longer in Linux.
I have created shared simple function that will always terminate string.
And few little improvements around. What do you think?
It complains a lot about returns from one_opt in option.c. I can make
patch that will deallocate memory before returning error. In some cases,
i think option parsing does not have to be fatal. Would you accept fixes
that will free memory before return? I think in some cases option
parsing can be used for files that can be reread multiple times when
running.
1.
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/diff/?id=f236da93df5be85409c24f03683e3d8c54fac72b
--
Petr Menšík
Software Engineer
Red Hat, http://www.redhat.com/
email: pemensik at redhat.com PGP: 65C6C973
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-lengths-of-interface-names.patch
Type: text/x-patch
Size: 11085 bytes
Desc: not available
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20180821/2a80c472/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Mark-die-function-as-never-returning.patch
Type: text/x-patch
Size: 1200 bytes
Desc: not available
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20180821/2a80c472/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Minor-improvements-in-lease-tools.patch
Type: text/x-patch
Size: 2324 bytes
Desc: not available
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20180821/2a80c472/attachment-0005.bin>
More information about the Dnsmasq-discuss
mailing list