[PATCH] D158562: [clang][Sema] Add truncation warning on fortified snprintf
Takuya Shimizu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 22 16:09:34 PDT 2023
hazohelet created this revision.
hazohelet added reviewers: aaron.ballman, serge-sans-paille, nickdesaulniers, tbaeder.
Herald added a project: All.
hazohelet requested review of this revision.
Herald added a project: clang.
This patch warns on `snprintf` calls whose `n` argument is known to be smaller than the size of the formatted string like
char buf[5];
snprintf(buf, 5, "Hello");
This is a counterpart of gcc's `Wformat-truncation`
Fixes https://github.com/llvm/llvm-project/issues/64871
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D158562
Files:
clang/docs/ReleaseNotes.rst
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaChecking.cpp
clang/test/Analysis/taint-generic.c
clang/test/Sema/format-strings.c
clang/test/Sema/warn-fortify-source.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158562.552527.patch
Type: text/x-patch
Size: 9564 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230822/b7833520/attachment-0001.bin>
More information about the cfe-commits
mailing list