[all-commits] [llvm/llvm-project] 0c9c9d: [clang][Sema] Add truncation warning on fortified ...
Takuya Shimizu via All-commits
all-commits at lists.llvm.org
Fri Aug 25 22:41:48 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 0c9c9dd9a24f9d715d950fef0ac7aae01437af96
https://github.com/llvm/llvm-project/commit/0c9c9dd9a24f9d715d950fef0ac7aae01437af96
Author: Takuya Shimizu <shimizu2486 at gmail.com>
Date: 2023-08-26 (Sat, 26 Aug 2023)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/lib/Sema/SemaChecking.cpp
M clang/test/Analysis/taint-generic.c
M clang/test/Sema/format-strings.c
M clang/test/Sema/warn-fortify-source.c
Log Message:
-----------
[clang][Sema] Add truncation warning on fortified snprintf
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
Reviewed By: aaron.ballman, nickdesaulniers
Differential Revision: https://reviews.llvm.org/D158562
More information about the All-commits
mailing list