diff options
author | Colin Watson <cjwatson@debian.org> | 2016-12-20 00:22:52 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2016-12-20 00:22:52 +0000 |
commit | 971a7653746a6972b907dfe0ce139c06e4a6f482 (patch) | |
tree | 70fb964265d57ae4967be55b75dbb2a122e9b969 /openbsd-compat/explicit_bzero.c | |
parent | a8ed8d256b2e2c05b0c15565a7938028c5192277 (diff) | |
parent | 4a354fc231174901f2629437c2a6e924a2dd6772 (diff) |
Import openssh_7.4p1.orig.tar.gz
Diffstat (limited to 'openbsd-compat/explicit_bzero.c')
-rw-r--r-- | openbsd-compat/explicit_bzero.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/openbsd-compat/explicit_bzero.c b/openbsd-compat/explicit_bzero.c index 3c85a4843..5078134d1 100644 --- a/openbsd-compat/explicit_bzero.c +++ b/openbsd-compat/explicit_bzero.c | |||
@@ -7,6 +7,8 @@ | |||
7 | 7 | ||
8 | #include "includes.h" | 8 | #include "includes.h" |
9 | 9 | ||
10 | #include <string.h> | ||
11 | |||
10 | /* | 12 | /* |
11 | * explicit_bzero - don't let the compiler optimize away bzero | 13 | * explicit_bzero - don't let the compiler optimize away bzero |
12 | */ | 14 | */ |
@@ -32,6 +34,17 @@ static void (* volatile ssh_bzero)(void *, size_t) = bzero; | |||
32 | void | 34 | void |
33 | explicit_bzero(void *p, size_t n) | 35 | explicit_bzero(void *p, size_t n) |
34 | { | 36 | { |
37 | /* | ||
38 | * clang -fsanitize=memory needs to intercept memset-like functions | ||
39 | * to correctly detect memory initialisation. Make sure one is called | ||
40 | * directly since our indirection trick above sucessfully confuses it. | ||
41 | */ | ||
42 | #if defined(__has_feature) | ||
43 | # if __has_feature(memory_sanitizer) | ||
44 | memset(p, 0, n); | ||
45 | # endif | ||
46 | #endif | ||
47 | |||
35 | ssh_bzero(p, n); | 48 | ssh_bzero(p, n); |
36 | } | 49 | } |
37 | 50 | ||