Workaround realpath FORTIFY crashes

This commit is contained in:
topjohnwu 2020-05-03 22:11:39 -07:00
parent a8d0936e04
commit 8ab045331b

View File

@ -454,9 +454,12 @@ int xinotify_init1(int flags) {
} }
char *xrealpath(const char *path, char *resolved_path) { 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) { if (ret == nullptr) {
PLOGE("xrealpath"); PLOGE("xrealpath");
} else {
strcpy(resolved_path, buf);
} }
return ret; return ret;
} }