[Dnsmasq-discuss] [PATCH] Inotify: Ignore backup files created by editors

Simon Kelley simon at thekelleys.org.uk
Wed Feb 14 18:43:09 GMT 2018


Patch applied, with two modifications.

1) I added a check for strlen(in->name) not being zero. I don't know if
inotify could give us a zero-length filename, but if it did, we'd make
an out-of-bounds array reference to in->name[-1]. I also saved the
return from strlen(in->name) in a variable, rather than call strlen
three times.

2) Move the resolv-file test to after the dotfiles test. Only relevant
if someone configures a resolv file name which looks like an editor
backup file, but at least in's consistent. Also allows removal of a
now-redundant in->len == 0 test.


Cheers,

Simon.



On 13/02/18 09:40, Andy Hawkins wrote:
> Use strlen to determine the length of the filename returned by
> inotify, as in->len refers to the length of the buffer containing
> the name, not the length of the name itself.
> 
> http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2018q1/011950.html
> 
> Signed-off-by: Andy Hawkins <andy at gently.org.uk>




More information about the Dnsmasq-discuss mailing list