#define INIT_GETRANDOM
#endif
-#if SANITIZER_INTERCEPT_CRYPT
-INTERCEPTOR(char *, crypt, char *key, char *salt) {
- void *ctx;
- COMMON_INTERCEPTOR_ENTER(ctx, crypt, key, salt);
- COMMON_INTERCEPTOR_READ_RANGE(ctx, key, internal_strlen(key) + 1);
- COMMON_INTERCEPTOR_READ_RANGE(ctx, salt, internal_strlen(salt) + 1);
- char *res = REAL(crypt)(key, salt);
- if (res != nullptr)
- COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, internal_strlen(res) + 1);
- return res;
-}
-#define INIT_CRYPT COMMON_INTERCEPT_FUNCTION(crypt);
-#else
-#define INIT_CRYPT
-#endif
-
-#if SANITIZER_INTERCEPT_CRYPT_R
-INTERCEPTOR(char *, crypt_r, char *key, char *salt, void *data) {
- void *ctx;
- COMMON_INTERCEPTOR_ENTER(ctx, crypt_r, key, salt, data);
- COMMON_INTERCEPTOR_READ_RANGE(ctx, key, internal_strlen(key) + 1);
- COMMON_INTERCEPTOR_READ_RANGE(ctx, salt, internal_strlen(salt) + 1);
- char *res = REAL(crypt_r)(key, salt, data);
- if (res != nullptr) {
- COMMON_INTERCEPTOR_WRITE_RANGE(ctx, data,
- __sanitizer::struct_crypt_data_sz);
- COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, internal_strlen(res) + 1);
- }
- return res;
-}
-#define INIT_CRYPT_R COMMON_INTERCEPT_FUNCTION(crypt_r);
-#else
-#define INIT_CRYPT_R
-#endif
-
#if SANITIZER_INTERCEPT_GETENTROPY
INTERCEPTOR(int, getentropy, void *buf, SIZE_T buflen) {
void *ctx;
INIT_GETUSERSHELL;
INIT_SL_INIT;
INIT_GETRANDOM;
- INIT_CRYPT;
- INIT_CRYPT_R;
INIT_GETENTROPY;
INIT_QSORT;
INIT_QSORT_R;
#define SANITIZER_INTERCEPT_FDEVNAME SI_FREEBSD
#define SANITIZER_INTERCEPT_GETUSERSHELL (SI_POSIX && !SI_ANDROID)
#define SANITIZER_INTERCEPT_SL_INIT (SI_FREEBSD || SI_NETBSD)
-#define SANITIZER_INTERCEPT_CRYPT (SI_POSIX && !SI_ANDROID)
-#define SANITIZER_INTERCEPT_CRYPT_R (SI_LINUX && !SI_ANDROID)
#define SANITIZER_INTERCEPT_GETRANDOM \
((SI_LINUX && __GLIBC_PREREQ(2, 25)) || SI_FREEBSD)
# include "sanitizer_platform_interceptors.h"
# include "sanitizer_platform_limits_posix.h"
-#if SANITIZER_INTERCEPT_CRYPT_R
-#include <crypt.h>
-#endif
-
namespace __sanitizer {
unsigned struct_utsname_sz = sizeof(struct utsname);
unsigned struct_stat_sz = sizeof(struct stat);
unsigned struct_statvfs64_sz = sizeof(struct statvfs64);
#endif // SANITIZER_GLIBC
-#if SANITIZER_INTERCEPT_CRYPT_R
- unsigned struct_crypt_data_sz = sizeof(struct crypt_data);
-#endif
-
#if SANITIZER_LINUX && !SANITIZER_ANDROID
unsigned struct_timex_sz = sizeof(struct timex);
unsigned struct_msqid_ds_sz = sizeof(struct msqid_ds);
extern unsigned struct_mq_attr_sz;
extern unsigned struct_timex_sz;
extern unsigned struct_statvfs_sz;
-extern unsigned struct_crypt_data_sz;
#endif // SANITIZER_LINUX && !SANITIZER_ANDROID
struct __sanitizer_iovec {
+++ /dev/null
-// RUN: %clangxx -O0 -g %s -lcrypt -o %t && %run %t
-
-// crypt.h is missing from Android.
-// UNSUPPORTED: android
-
-#include <assert.h>
-#include <unistd.h>
-#include <cstring>
-#include <crypt.h>
-
-int main(int argc, char **argv) {
- {
- crypt_data cd;
- cd.initialized = 0;
- char *p = crypt_r("abcdef", "xz", &cd);
- volatile size_t z = strlen(p);
- }
- {
- crypt_data cd;
- cd.initialized = 0;
- char *p = crypt_r("abcdef", "$1$", &cd);
- volatile size_t z = strlen(p);
- }
- {
- crypt_data cd;
- cd.initialized = 0;
- char *p = crypt_r("abcdef", "$5$", &cd);
- volatile size_t z = strlen(p);
- }
- {
- crypt_data cd;
- cd.initialized = 0;
- char *p = crypt_r("abcdef", "$6$", &cd);
- volatile size_t z = strlen(p);
- }
-}
+++ /dev/null
-// RUN: %clangxx -O0 -g %s -o %t -lcrypt && %run %t
-
-// crypt() is missing from Android and -lcrypt from darwin.
-// UNSUPPORTED: android, darwin
-
-#include <assert.h>
-#include <unistd.h>
-#include <cstring>
-#if __has_include(<crypt.h>)
-#include <crypt.h>
-#endif
-
-int
-main (int argc, char** argv)
-{
- {
- char *p = crypt("abcdef", "xz");
- volatile size_t z = strlen(p);
- }
- {
- char *p = crypt("abcdef", "$1$");
- volatile size_t z = strlen(p);
- }
- {
- char *p = crypt("abcdef", "$5$");
- volatile size_t z = strlen(p);
- }
- {
- char *p = crypt("abcdef", "$6$");
- volatile size_t z = strlen(p);
- }
-}