summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_common_interceptors.inc
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-12-21 19:22:26 +0000
committerKostya Serebryany <kcc@google.com>2015-12-21 19:22:26 +0000
commitb716d999dab3879210de6323d1e61c80f778e1d1 (patch)
treead04ae05ba5d19744bdbe9f54d3f1133062b6508 /lib/sanitizer_common/sanitizer_common_interceptors.inc
parentbcc273f55551aa32f0d91cc1260fd6df858d8b09 (diff)
[asan] fix fopen interceptor to not crash if path is NULL
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@256182 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_common_interceptors.inc')
-rw-r--r--lib/sanitizer_common/sanitizer_common_interceptors.inc2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sanitizer_common/sanitizer_common_interceptors.inc b/lib/sanitizer_common/sanitizer_common_interceptors.inc
index e56f6bf7e..4639ddc92 100644
--- a/lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ b/lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -4769,7 +4769,7 @@ INTERCEPTOR(int, __woverflow, __sanitizer_FILE *fp, int ch) {
INTERCEPTOR(__sanitizer_FILE *, fopen, const char *path, const char *mode) {
void *ctx;
COMMON_INTERCEPTOR_ENTER(ctx, fopen, path, mode);
- COMMON_INTERCEPTOR_READ_RANGE(ctx, path, REAL(strlen)(path) + 1);
+ if (path) COMMON_INTERCEPTOR_READ_RANGE(ctx, path, REAL(strlen)(path) + 1);
COMMON_INTERCEPTOR_READ_RANGE(ctx, mode, REAL(strlen)(mode) + 1);
__sanitizer_FILE *res = REAL(fopen)(path, mode);
COMMON_INTERCEPTOR_FILE_OPEN(ctx, res, path);