================ @@ -0,0 +1,59 @@ +// RUN: %check_clang_tidy %s bugprone-undefined-sprintf-overlap %t + +using size_t = decltype(sizeof(int)); + +extern "C" int sprintf(char *s, const char *format, ...); +extern "C" int snprintf(char *s, size_t n, const char *format, ...); + +namespace std { + int snprintf(char *s, size_t n, const char *format, ...); +} + +struct st_t { + char buf[10]; + char buf2[10]; +}; + +void first_arg_overlaps() { + char buf[10]; + sprintf(buf, "%s", buf); ---------------- nicovank wrote:
Add a test case where `buf` is the the first argument, e.g. `sprintf(buf, "%d%s", 0, buf);` to catch possible regressions. https://github.com/llvm/llvm-project/pull/114244 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits