Re: [iptables PATCH 20/28] Sanitize calls to strcpy()

2018-09-24 Thread Florian Westphal
Phil Sutter wrote: > - use snprintf(), > - use strlcpy() from libbsd or > - introduce a poor-man's strlcpy() macro/function. > > What would you prefer? Leave everything as-is, one of the above or > something completely different? :) I don't really care that much, I'd avoid adding new dependency

Re: [iptables PATCH 20/28] Sanitize calls to strcpy()

2018-09-24 Thread Phil Sutter
Hi Florian, On Mon, Sep 24, 2018 at 11:11:59AM +0200, Florian Westphal wrote: > Phil Sutter wrote: > > Make sure destination buffers are NULL-terminated by replacing strcpy() > > with strncat() (if destination is guaranteed to be zeroed) or explicitly > > set last byte in buffer to zero. > >

Re: [iptables PATCH 20/28] Sanitize calls to strcpy()

2018-09-24 Thread Florian Westphal
Phil Sutter wrote: > Make sure destination buffers are NULL-terminated by replacing strcpy() > with strncat() (if destination is guaranteed to be zeroed) or explicitly > set last byte in buffer to zero. I'm sorry, but i don't like this at all. > - strcpy(cs->target->t->u.user.name,

[iptables PATCH 20/28] Sanitize calls to strcpy()

2018-09-19 Thread Phil Sutter
Make sure destination buffers are NULL-terminated by replacing strcpy() with strncat() (if destination is guaranteed to be zeroed) or explicitly set last byte in buffer to zero. While being at it, replace two direct calls to calloc() with xtables_calloc() since that takes care of error checking.