Skip to content

Commit 1b11b64

Browse files
peffgitster
authored andcommitted
banned.h: mark strcat() as banned
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 f063d38 (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>
1 parent c8af66a commit 1b11b64

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

banned.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,7 @@
1212

1313
#undef strcpy
1414
#define strcpy(x,y) BANNED(strcpy)
15+
#undef strcat
16+
#define strcat(x,y) BANNED(strcat)
1517

1618
#endif /* BANNED_H */

0 commit comments

Comments
 (0)