diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2014-07-14 13:07:51 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2014-07-14 13:07:51 +0000 |
commit | a5c9e6790d373c6b355087d544a42ad63466211c (patch) | |
tree | edf0395d1854bbdbc7610a169ea8549125c90bb1 /lib | |
parent | 01ed54b80ea0c0b149ebe16a37f4ebd5480f96d1 (diff) | |
download | compiler-rt-a5c9e6790d373c6b355087d544a42ad63466211c.tar.gz |
[sanitizer] Intercept getpass.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@212937 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sanitizer_common/sanitizer_common_interceptors.inc | 17 | ||||
-rw-r--r-- | lib/sanitizer_common/sanitizer_platform_interceptors.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_common_interceptors.inc b/lib/sanitizer_common/sanitizer_common_interceptors.inc index 64ddeed3d..339434e31 100644 --- a/lib/sanitizer_common/sanitizer_common_interceptors.inc +++ b/lib/sanitizer_common/sanitizer_common_interceptors.inc @@ -4628,6 +4628,22 @@ INTERCEPTOR(int, dlclose, void *handle) { #define INIT_DLOPEN_DLCLOSE #endif +#if SANITIZER_INTERCEPT_GETPASS +INTERCEPTOR(char *, getpass, const char *prompt) { + void *ctx; + COMMON_INTERCEPTOR_ENTER(ctx, getpass, prompt); + if (prompt) + COMMON_INTERCEPTOR_READ_RANGE(ctx, prompt, REAL(strlen)(prompt)+1); + char *res = REAL(getpass)(prompt); + if (res) COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, REAL(strlen)(res)+1); + return res; +} + +#define INIT_GETPASS COMMON_INTERCEPT_FUNCTION(getpass); +#else +#define INIT_GETPASS +#endif + static void InitializeCommonInterceptors() { static u64 metadata_mem[sizeof(MetadataHashMap) / sizeof(u64) + 1]; interceptor_metadata_map = new((void *)&metadata_mem) MetadataHashMap(); @@ -4786,4 +4802,5 @@ static void InitializeCommonInterceptors() { INIT_FFLUSH; INIT_FCLOSE; INIT_DLOPEN_DLCLOSE; + INIT_GETPASS; } diff --git a/lib/sanitizer_common/sanitizer_platform_interceptors.h b/lib/sanitizer_common/sanitizer_platform_interceptors.h index e9d5c35a7..9b8c19cb5 100644 --- a/lib/sanitizer_common/sanitizer_platform_interceptors.h +++ b/lib/sanitizer_common/sanitizer_platform_interceptors.h @@ -222,5 +222,6 @@ #define SANITIZER_INTERCEPT_FFLUSH SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_FCLOSE SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_DLOPEN_DLCLOSE SI_LINUX_NOT_ANDROID || SI_MAC +#define SANITIZER_INTERCEPT_GETPASS SI_LINUX_NOT_ANDROID || SI_MAC #endif // #ifndef SANITIZER_PLATFORM_INTERCEPTORS_H |