================ @@ -672,7 +671,7 @@ inline bool LocalAddressSpace::findFunctionName(pint_t addr, char *buf, Dl_info dyldInfo; if (dladdr((void *)addr, &dyldInfo)) { if (dyldInfo.dli_sname != NULL) { - snprintf(buf, bufLen, "%s", dyldInfo.dli_sname); + strncpy(buf, dyldInfo.dli_sname, bufLen); ---------------- michael-kenzel wrote:
Indeed. I did a quick test on my machine here: ``` ------------------------------------------------------------- Benchmark Time CPU Iterations ------------------------------------------------------------- copy_snprintf 4005109 ns 4005097 ns 175 copy_strncpy 3580506 ns 3580409 ns 194 copy_memcpy_strlen 3346781 ns 3346773 ns 213 ``` so doing `strlen` + `memcpy` seems to be the best option. I'll update the PR. https://github.com/llvm/llvm-project/pull/72040 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits