[PATCH] Log client process name in winbindd
Jeremy Allison
jra at samba.org
Fri Nov 9 00:01:05 UTC 2018
On Fri, Nov 09, 2018 at 12:56:27PM +1300, Andrew Bartlett wrote:
> On Thu, 2018-11-08 at 15:52 -0800, Jeremy Allison via samba-technical
> wrote:
> > On Thu, Nov 08, 2018 at 08:03:30PM +0100, Andreas Schneider wrote:
> > > > EWRONGPATCH :-).
> > >
> > > Ups, sorry.
> >
> > Can you add error return checks for all uses of
> > snprintf to check for truncated output please ?
> >
> > RETURN VALUE
> > Upon successful return, these functions return the number of characters printed (excluding the null byte used to end output to strings).
> >
> > The functions snprintf() and vsnprintf() do not write more than size bytes (including the terminating null byte ('\0')). If the output was truncated due to this limit,
> > then the return value is the number of characters (excluding the terminating null byte) which would have been written to the final string if enough space had been availā
> > able. Thus, a return value of size or more means that the output was truncated. (See also below under NOTES.)
> >
> > If an output error is encountered, a negative value is returned.
> >
> > Now maybe the correct thing to do is
> > ignore the truncation, but we need to
> > at least acknowledge it in the source
> > (even if it's with some kind of an
> > 'ignore' comment).
>
> G'Day Jeremy,
>
> I think you have answered yourself here. What could possibly,
> practically be done other than to ignore it? We don't want a long
> process name to change the behaviour here).
Yeah, OK. But I get nervous when I see
snprintf(buf, len, XXXX...)
calls with no checks. Maybe just make them
into:
(void)snprintf(buf, len, XXXX...)
so it's explicit we're ignoring the return ?
More information about the samba-technical
mailing list