[clang-tidy] Add the `bugprone-unsafe-functions` check
authorGergely Fűtő <futogergely@gmail.com>
Mon, 29 Nov 2021 08:56:48 +0000 (09:56 +0100)
committerWhisperity <whisperity@gmail.com>
Thu, 2 Feb 2023 13:11:42 +0000 (14:11 +0100)
commitf27c8ac83e7cb945c8b3f9bf0092f8cf93278b5c
tree9fe2d505362bed77a70a3b86ccb699ce6be1a459
parentfb91f0a298492ed7db8928e18cda35228474007e
[clang-tidy] Add the `bugprone-unsafe-functions` check

Checks for unsafe functions, mostly those listed in the
SEI CERT C Coding Standard Recommendation `MSC24-C` and Rule `MSC33-C`.

For the listed functions, an alternative, more secure replacement is
suggested, if such is available. The checker heavily relies on the
functions from "Annex K" (Bounds-checking interfaces) from C11, but
there are several other recommendations not directly from Annex K.

Differential Revision: http://reviews.llvm.org/D91000

Reviewed-By: aaron.ballman, dkrupp, steakhal, whisperity
Co-Authored-By: Tamás Koller <koller.tamas1996@gmail.com>
Co-Authored-By: Balázs Benics <balazs.benics@sigmatechnology.se>
Co-Authored-By: Whisperity <whisperity@gmail.com>
clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
clang-tools-extra/clang-tidy/bugprone/UnsafeFunctionsCheck.cpp [new file with mode: 0644]
clang-tools-extra/clang-tidy/bugprone/UnsafeFunctionsCheck.h [new file with mode: 0644]
clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp
clang-tools-extra/docs/ReleaseNotes.rst
clang-tools-extra/docs/clang-tidy/checks/bugprone/unsafe-functions.rst [new file with mode: 0644]
clang-tools-extra/docs/clang-tidy/checks/cert/msc24-c.rst [new file with mode: 0644]
clang-tools-extra/docs/clang-tidy/checks/cert/msc33-c.rst [new file with mode: 0644]
clang-tools-extra/docs/clang-tidy/checks/list.rst
clang-tools-extra/test/clang-tidy/checkers/bugprone/unsafe-functions.c [new file with mode: 0644]