[clang] [-Wunsafe-buffer-usage] Add check for custom printf/scanf functions (PR #173096)
Hans Wennborg via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 12 05:24:18 PST 2026
zmodem wrote:
We're seeing another couple of false positives:
```
printf("%s", b ? "true" : "false");
```
and
```
constexpr char s[] = "foo";
printf("%s", s);
```
It would be nice if the warning didn't fire on those.
I also wonder if we should relax the "c_str() check" a little, to accommodate custom string implementations. If something has a c_str() method, wouldn't it be fair to assume that's going to be a null terminated string?
https://github.com/llvm/llvm-project/pull/173096
More information about the cfe-commits
mailing list