From 8ab045331bf0055ef92a8ca4e26c66bf2108724f Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sun, 3 May 2020 22:11:39 -0700 Subject: [PATCH] Workaround realpath FORTIFY crashes --- native/jni/utils/xwrap.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/native/jni/utils/xwrap.cpp b/native/jni/utils/xwrap.cpp index 4ec92bb9c..3a5d67b2b 100644 --- a/native/jni/utils/xwrap.cpp +++ b/native/jni/utils/xwrap.cpp @@ -454,9 +454,12 @@ int xinotify_init1(int flags) { } char *xrealpath(const char *path, char *resolved_path) { - char *ret = realpath(path, resolved_path); + char buf[PATH_MAX]; + char *ret = realpath(path, buf); if (ret == nullptr) { PLOGE("xrealpath"); + } else { + strcpy(resolved_path, buf); } return ret; }