[PATCH] lib/util: Add optional format argument to timeval_str_buf()
Volker Lendecke
Volker.Lendecke at SerNet.DE
Thu Oct 9 12:35:22 MDT 2014
On Thu, Oct 09, 2014 at 09:05:40PM +1100, Martin Schwenke wrote:
> > Hmm. Right now the timeval_str_buf function can be assumed to never fail,
> > because timeval_buf is large enough. If we now add a format argument,
> > it could easily overflow unnoticed. Is that what we want?
>
> No. Thanks for picking that up. You'd have to be trying hard to
> overflow 128 byte of time string... but my code should have been
> better... :-)
>
> I'd be happy if it truncated instead of overflowing. However,
> strftime(3) doesn't provide such an option - it returns 0 and output
> is undefined on potential overflow.
What is your actual use case of this?
Thanks,
Volker
--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
More information about the samba-technical
mailing list