From 7357a35f8d2d743a7bb37c8f1168260173f13e19 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sun, 7 Aug 2022 05:03:18 -0700 Subject: [PATCH] Fix build errors --- native/src/base/compat/fortify.hpp | 5 +++++ native/src/base/files.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/native/src/base/compat/fortify.hpp b/native/src/base/compat/fortify.hpp index 6fa6d4e81..e624e233e 100644 --- a/native/src/base/compat/fortify.hpp +++ b/native/src/base/compat/fortify.hpp @@ -26,6 +26,11 @@ static inline void __check_buffer_access(const char* fn, const char* action, __fortify_fatal("%s: prevented %zu-byte %s %zu-byte buffer", fn, claim, action, actual); } } +void* __memcpy_chk(void* dst, const void* src, size_t count, size_t dst_len) { + __check_count("memcpy", "count", count); + __check_buffer_access("memcpy", "write into", count, dst_len); + return __call_bypassing_fortify(memcpy)(dst, src, count); +} char* __strcpy_chk(char* dst, const char* src, size_t dst_len) { // TODO: optimize so we don't scan src twice. size_t src_len = __builtin_strlen(src) + 1; diff --git a/native/src/base/files.cpp b/native/src/base/files.cpp index 0896df136..46b64615e 100644 --- a/native/src/base/files.cpp +++ b/native/src/base/files.cpp @@ -440,7 +440,7 @@ void restore_folder(const char *dir, vector &files) { for (raw_file &file : files) { string path = base + "/" + file.path; if (S_ISDIR(file.attr.st.st_mode)) { - mkdirs(path, 0); + mkdirs(path.data(), 0); } else if (S_ISREG(file.attr.st.st_mode)) { if (auto fp = xopen_file(path.data(), "we")) fwrite(file.content.data(), 1, file.content.size(), fp.get());