<div dir="ltr"><div dir="ltr">On Mon, Nov 8, 2021 at 7:03 AM Aaron Ballman via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Sun, Nov 7, 2021 at 10:26 AM Jayson Yan via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br>
><br>> We’re interested in warning against the usage of the “%n” format string specifier to discourage developers from using this potentially unsafe format specifier.<br>
<br>
Potentially unsafe in what way? As mentioned on the ongoing code<br>
review for this topic (<a href="https://reviews.llvm.org/D110436" rel="noreferrer" target="_blank">https://reviews.llvm.org/D110436</a>), use of `%n`<br>
by itself is not unsafe. What is unsafe is when the format string<br>
itself is what's under attacker control so they can insert their own<br>
`%n` unbeknownst to the programmer, but that is a much harder problem<br>
to diagnose because there are legitimate cases for having a<br>
non-literal format specifier.<br></blockquote><div><br></div><div>...and Clang already has a diagnostic for non-literal format specifiers.</div><div>+1 to everything Aaron has said here, which we've also said over on <a href="https://reviews.llvm.org/D110436" rel="noreferrer" target="_blank">https://reviews.llvm.org/D110436</a>.</div><div><br></div><div>–Arthur</div></div></div>