diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2004-07-20 20:47:33 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2004-07-20 20:47:33 +0000 |
commit | 85680f6336b285eb6c24e97bdd6efe033079ff0c (patch) | |
tree | 7fb80d35d729ac5c0dfdf1cf332294e45b08af96 /gnu/usr.bin | |
parent | 0e46a729a0f73826d6c8f0427d19b7777e03efd8 (diff) |
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@
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r-- | gnu/usr.bin/gcc/gcc/builtins.c | 4 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/gcc/config/openbsd.h | 5 |
2 files changed, 9 insertions, 0 deletions
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 |