git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] banned.h: mark strncat() as banned
@ 2019-01-02  9:38 Eric Wong
  2019-01-02 18:00 ` Eric Sunshine
  2019-01-03  4:49 ` Jeff King
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Wong @ 2019-01-02  9:38 UTC (permalink / raw)
  To: Jeff King, Junio C Hamano; +Cc: git

strncat() has the same quadratic behavior as strcat() and is
difficult-to-read and bug-prone.  While it hasn't yet been a
problem in git iself, strncat() found it's way into 'master'
of cgit and caused segfaults on my system.

Signed-off-by: Eric Wong <e@80x24.org>
---
 banned.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/banned.h b/banned.h
index 28f5937035..447af24807 100644
--- a/banned.h
+++ b/banned.h
@@ -16,6 +16,8 @@
 #define strcat(x,y) BANNED(strcat)
 #undef strncpy
 #define strncpy(x,y,n) BANNED(strncpy)
+#undef strncat
+#define strncat(x,y,n) BANNED(strncat)
 
 #undef sprintf
 #undef vsprintf
-- 
EW


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-03  4:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-02  9:38 [PATCH] banned.h: mark strncat() as banned Eric Wong
2019-01-02 18:00 ` Eric Sunshine
2019-01-03  4:49 ` Jeff King

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).