@@ -6104,6 +6104,40 @@ INTERCEPTOR(__sanitizer_FILE *, freopen, const char *path, const char *mode,
6104
6104
#define INIT_FOPEN
6105
6105
#endif
6106
6106
6107
+ #if SANITIZER_INTERCEPT_FLOPEN
6108
+ INTERCEPTOR (int , flopen, const char *path, int flags, ...) {
6109
+ void *ctx;
6110
+ va_list ap;
6111
+ va_start (ap, flags);
6112
+ u16 mode = static_cast <u16>(va_arg (ap, u32));
6113
+ va_end (ap);
6114
+ COMMON_INTERCEPTOR_ENTER (ctx, flopen, path, flags, mode);
6115
+ if (path) {
6116
+ COMMON_INTERCEPTOR_READ_RANGE (ctx, path, REAL (strlen )(path) + 1 );
6117
+ }
6118
+ return REAL (flopen)(path, flags, mode);
6119
+ }
6120
+
6121
+ INTERCEPTOR (int , flopenat, int dirfd, const char *path, int flags, ...) {
6122
+ void *ctx;
6123
+ va_list ap;
6124
+ va_start (ap, flags);
6125
+ u16 mode = static_cast <u16>(va_arg (ap, u32));
6126
+ va_end (ap);
6127
+ COMMON_INTERCEPTOR_ENTER (ctx, flopen, path, flags, mode);
6128
+ if (path) {
6129
+ COMMON_INTERCEPTOR_READ_RANGE (ctx, path, REAL (strlen )(path) + 1 );
6130
+ }
6131
+ return REAL (flopenat)(dirfd, path, flags, mode);
6132
+ }
6133
+
6134
+ #define INIT_FLOPEN \
6135
+ COMMON_INTERCEPT_FUNCTION (flopen); \
6136
+ COMMON_INTERCEPT_FUNCTION (flopenat);
6137
+ #else
6138
+ #define INIT_FLOPEN
6139
+ #endif
6140
+
6107
6141
#if SANITIZER_INTERCEPT_FOPEN64
6108
6142
INTERCEPTOR (__sanitizer_FILE *, fopen64, const char *path, const char *mode) {
6109
6143
void *ctx;
@@ -10269,6 +10303,7 @@ static void InitializeCommonInterceptors() {
10269
10303
INIT_LIBIO_INTERNALS;
10270
10304
INIT_FOPEN;
10271
10305
INIT_FOPEN64;
10306
+ INIT_FLOPEN;
10272
10307
INIT_OPEN_MEMSTREAM;
10273
10308
INIT_OBSTACK;
10274
10309
INIT_FFLUSH;
0 commit comments