[clang] [Clang][Sema] Add fortify warnings for realpath (PR #230695)

Nick Desaulniers via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 3 13:58:27 PST 2026


================
@@ -1059,6 +1059,11 @@ def warn_fortify_source_overread : Warning<
   "size %1, but the size is %2">,
   InGroup<FortifySource>;
 
+def warn_fortify_source_buffer_too_small : Warning<
+  "'%0' may overflow; destination buffer has size %1, but at least %2 bytes "
+  "are required">,
+  InGroup<FortifySource>;
----------------
nickdesaulniers wrote:

Ok, but I think the identifier then should be renamed to be more specific to the "pass NULL" which only makes sense for `realpath`: `s/warn_fortify_source_buffer_too_small/warn_fortify_realpath_overflow/`

https://github.com/llvm/llvm-project/pull/230695


More information about the cfe-commits mailing list