[PATCH] D45050: [clang-tidy] New checker for not null-terminated result caused by strlen or wcslen
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 23 04:34:40 PDT 2018
aaron.ballman added inline comments.
================
Comment at: clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp:226
+ DiagnosticBuilder &Diag) {
+ if (getLangOpts().CPlusPlus11) {
+ StringRef NewFuncName = (Name[0] != 'w') ? "strncpy_s" : "wcsncpy_s";
----------------
Charusso wrote:
> aaron.ballman wrote:
> > What about C?
> The `else` part would fire.
I think this comment got moved to an unrelated area. I was talking about `NotNullTerminatedResultCheck::memmoveFix()`, where there is no `else` clause. However, I'm also not entirely certain why you are assuming the _s versions of those functions are available in C++ (they're in Annex K for C, which is an optional annex).
https://reviews.llvm.org/D45050
More information about the cfe-commits
mailing list