From 85680f6336b285eb6c24e97bdd6efe033079ff0c Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Tue, 20 Jul 2004 20:47:33 +0000 Subject: Do not provide builtins for strcpy() and strcat(), as done with gcc 2, on the sole purpose of making these easier to spot and exterminate. tested by various people on amd64 and I on arm&sparc64, ok deraadt@ --- gnu/usr.bin/gcc/gcc/builtins.c | 4 ++++ gnu/usr.bin/gcc/gcc/config/openbsd.h | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/gnu/usr.bin/gcc/gcc/builtins.c b/gnu/usr.bin/gcc/gcc/builtins.c index e0c8ce04601..b0ca7105aff 100644 --- a/gnu/usr.bin/gcc/gcc/builtins.c +++ b/gnu/usr.bin/gcc/gcc/builtins.c @@ -3906,9 +3906,11 @@ expand_builtin (exp, target, subtarget, mode, ignore) break; case BUILT_IN_STRCPY: +#ifndef NO_UNSAFE_BUILTINS target = expand_builtin_strcpy (exp, target, mode); if (target) return target; +#endif break; case BUILT_IN_STRNCPY: @@ -3918,9 +3920,11 @@ expand_builtin (exp, target, subtarget, mode, ignore) break; case BUILT_IN_STRCAT: +#ifndef NO_UNSAFE_BUILTINS target = expand_builtin_strcat (arglist, target, mode); if (target) return target; +#endif break; case BUILT_IN_STRNCAT: diff --git a/gnu/usr.bin/gcc/gcc/config/openbsd.h b/gnu/usr.bin/gcc/gcc/config/openbsd.h index bf37f77a864..b6daf8521f0 100644 --- a/gnu/usr.bin/gcc/gcc/config/openbsd.h +++ b/gnu/usr.bin/gcc/gcc/config/openbsd.h @@ -314,3 +314,8 @@ do { \ work. On the other hand, we don't define HANDLE_PRAGMA_WEAK directly, as this depends on a few other details as well... */ #define HANDLE_SYSV_PRAGMA 1 + +/* Disable the use of unsafe builtin functions, (strcat, strcpy), making + * them easier to spot in the object files. + */ +#define NO_UNSAFE_BUILTINS -- cgit v1.2.3