On Mon, Nov 30, 2020 at 9:30 PM Jeff King <peff@xxxxxxxx> wrote: > We might also want to do this on top: > > -- >8 -- > Subject: [PATCH] banned.h: mark non-reentrant gmtime, etc as banned > > The traditional gmtime(), localtime(), ctime(), and asctime() functions > return pointers to shared storage. This means they're not thread-safe, > and they also run the risk of somebody holding onto the result across > multiple calls (where each call invalidates the previous result). > > All callers should be using gmtime_r() or localtime_r() instead. > > The ctime_r() and asctime_r() functions are OK in that respect, but have > no check that the buffer we pass in is long enough (the manpage says it > "should have room for at least 26 bytes"). Since this is such an > easy-to-get-wrong interface, and since we have the much safer stftime() > as well as its more conveinent strbuf_addftime() wrapper, let's likewise > ban both of those. s/conveinent/convenient/ I forgot all about banned.h. This patch does seem worthwhile to take.