[PATCH] lib/util: Add optional format argument to timeval_str_buf()
Martin Schwenke
martin at meltin.net
Fri Oct 10 18:40:31 MDT 2014
On Fri, 10 Oct 2014 21:19:16 +1100, Martin Schwenke <martin at meltin.net>
wrote:
> On Fri, 10 Oct 2014 12:14:14 +0200, Volker Lendecke
> <Volker.Lendecke at SerNet.DE> wrote:
> > Technically it's missing a bounds check for dst->buf + len
> > in the last snprintf. Probably that belongs into that
> > if(rfc3339){ clause. This will never kick in, but it
> > looks fishy and I'd like to have it the same as the
> > if-statement before
>
> OK, will do that. Thanks...
>
> I should actually make sure there's enough space, right? That is:
>
> (len < sizeof(dst->buf))
>
> just says there's enough room for the NUL byte, but not necessarily for
> what will be written.
OK, after some sleep I see that the above is better. :-) It will let
snprintf() truncate instead of deciding to not print a whole
component - not that this will ever happen. Cool! Done!
> I might actually change it to RFC5424. RFC3339 is a bit weaker and I'm
> planning to use it for RFC5424, so no use leaving room for someone
> else to come along and break it by misnaming it.
Done and attached...
peace & happiness,
martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: samba.patches
Type: application/octet-stream
Size: 5777 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20141011/9206edcb/attachment.obj>
More information about the samba-technical
mailing list