[compiler-rt] [compiler-rt][asan] Add wcscpy/wcsncpy; enable wcscat/wcsncat on Windows (PR #160493)

Thurston Dang via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 24 09:29:28 PDT 2025


================
@@ -570,6 +579,20 @@ INTERCEPTOR(char *, strcpy, char *to, const char *from) {
   return REAL(strcpy)(to, from);
 }
 
+INTERCEPTOR(wchar_t *, wcscpy, wchar_t *to, const wchar_t *from) {
+  void *ctx;
+  ASAN_INTERCEPTOR_ENTER(ctx, wcscpy);
+  if (!TryAsanInitFromRtl())
+    return REAL(wcscpy)(to, from);
+  if (flags()->replace_str) {
+    uptr from_size = (internal_wcslen(from) + 1) * sizeof(wchar_t);
----------------
thurstond wrote:

`from_size` is also used as the `to_size`. Could it be called `size` instead?

https://github.com/llvm/llvm-project/pull/160493


More information about the llvm-commits mailing list