[PATCH] lib/util: Add optional format argument to timeval_str_buf()

Martin Schwenke martin at meltin.net
Fri Oct 10 04:19:16 MDT 2014

On Fri, 10 Oct 2014 12:14:14 +0200, Volker Lendecke
<Volker.Lendecke at SerNet.DE> wrote:

> On Fri, Oct 10, 2014 at 07:20:03PM +1100, Martin Schwenke wrote:
> > Is this better?  :-)
> Much better, thanks!
> 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.

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.

Tomorrow...  :-)

peace & happiness,

More information about the samba-technical mailing list