banned.h: mark strcat() as banned
authorJeff King <peff@peff.net>
Tue, 24 Jul 2018 09:26:39 +0000 (05:26 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 26 Jul 2018 17:12:50 +0000 (10:12 -0700)
The strcat() function has all of the same overflow problems
as strcpy(). And as a bonus, it's easy to end up
accidentally quadratic, as each subsequent call has to walk
through the existing string.

The last strcat() call went away in f063d38b80 (daemon: use
cld->env_array when re-spawning, 2015-09-24). In general,
strcat() can be replaced either with a dynamic string
(strbuf or xstrfmt), or with xsnprintf if you know the
length is bounded.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
banned.h
index 1a3e52657060a35d869244b32963e613d035374d..34f22a4c25658b326d04c28d9fb096d2c4671859 100644 (file)
--- a/banned.h
+++ b/banned.h
@@ -12,5 +12,7 @@
 
 #undef strcpy
 #define strcpy(x,y) BANNED(strcpy)
+#undef strcat
+#define strcat(x,y) BANNED(strcat)
 
 #endif /* BANNED_H */