[clang-tools-extra] Add bugprone-sprintf-overlap (PR #114244)
    via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Thu Oct 31 07:50:16 PDT 2024
    
    
  
================
@@ -0,0 +1,23 @@
+.. title:: clang-tidy - bugprone-undefined-sprintf-overlap
+
+bugprone-undefined-sprintf-overlap
+==================================
+
+Warns if any arguments to the sprintf family of functions overlap with the
+first argument.
+
+.. code-block:: c++
+
+    char buf[20] = {"hi"};
+    sprintf(buf, "%s%d", buf, 0);
+
+C99 and POSIX.1-2001 states that if copying were to take place between objects
+that overlap, the result is undefined.
+
+Options
+-------
+
+.. option:: SprintfRegex
+
+   A regex specifying the sprintf family of functions to match on. By default,
+   this is "(::std)?::sn?printf".
----------------
EugeneZelenko wrote:
```suggestion
   this is `(::std)?::sn?printf`.
```
https://github.com/llvm/llvm-project/pull/114244
    
    
More information about the cfe-commits
mailing list