summaryrefslogtreecommitdiff
path: root/banned.h
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2020-12-01 21:11:38 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-12-02 22:30:39 (GMT)
commit91aef030152d121f6b4bc3b933c696073ba073e2 (patch)
tree576aabc81144240c2a5574c481f7fa77a64d54f3 /banned.h
parent1fbfdf556f2abc708183caca53ae4e2881b46ae2 (diff)
downloadgit-91aef030152d121f6b4bc3b933c696073ba073e2.zip
git-91aef030152d121f6b4bc3b933c696073ba073e2.tar.gz
git-91aef030152d121f6b4bc3b933c696073ba073e2.tar.bz2
banned.h: mark ctime_r() and asctime_r() as banned
The ctime_r() and asctime_r() functions are reentrant, 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 strftime() as well as its more convenient strbuf_addftime() wrapper, let's ban both of those. Signed-off-by: Jeff King <peff@peff.net> Reviewed-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'banned.h')
-rw-r--r--banned.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/banned.h b/banned.h
index ed11300..7ab4f2e 100644
--- a/banned.h
+++ b/banned.h
@@ -35,7 +35,11 @@
#define localtime(t) BANNED(localtime)
#undef ctime
#define ctime(t) BANNED(ctime)
+#undef ctime_r
+#define ctime_r(t, buf) BANNED(ctime_r)
#undef asctime
#define asctime(t) BANNED(asctime)
+#undef asctime_r
+#define asctime_r(t, buf) BANNED(asctime_r)
#endif /* BANNED_H */