git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] banned.h: mark strncat() as banned

From
EWEric Wong <e@80x24.org>
Date
Jan 2, 2019, 09:38 UTC
Message-ID
<20190102093846.6664-1-e@80x24.org>

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
Next: Eric Sunshine
Message 1 of 3 in “banned.h: mark strncat() as banned”
  1. banned.h: mark strncat() as bannedEric Wong, Jan 2, 2019
  2. Eric SunshineJan 2, 2019
  3. Jeff KingJan 3, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.