[compiler-rt] [compiler-rt][tysan] adding posix strndup interception. (PR #122255)

David CARLIER via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 9 07:15:32 PST 2025


================
@@ -99,6 +105,15 @@ INTERCEPTOR(char *, __strdup, const char *s) {
 }
 #endif // TYSAN_INTERCEPT___STRDUP
 
+#if TYSAN_INTERCEPT___STRNDUP
+INTERCEPTOR(char *, strndup, const char *s, SIZE_T slen) {
+  char *res = REAL(strndup)(s, slen);
+  if (res)
+    tysan_copy_types(res, const_cast<char *>(s), Min(internal_strlen(s), slen));
----------------
devnexen wrote:

indeed there is no need I did same as existing *strdup, maybe this call had a different signature before. Anyhow will update these later.

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


More information about the llvm-commits mailing list