def warn_os_log_format_narg : Error<
"os_log() '%%n' format specifier is not allowed">, DefaultError;
+def warn_format_narg : Warning<
+ "'%%n' format specifier support is deactivated and will call abort(3)">;
+
// Statements.
def err_continue_not_in_loop : Error<
"'continue' statement not in loop statement">;
return true;
}
+ // %n is not allowed anywhere
+ if (CS.getKind() == ConversionSpecifier::nArg) {
+ EmitFormatDiagnostic(S.PDiag(diag::warn_format_narg),
+ getLocationOfByte(CS.getStart()),
+ /*IsStringLocation*/ false,
+ getSpecifierRange(startSpecifier, specifierLen));
+ return true;
+ }
+
// Only scalars are allowed for os_trace.
if (FSType == Sema::FST_OSTrace &&
(CS.getKind() == ConversionSpecifier::PArg ||
-.\" $OpenBSD: clang-local.1,v 1.21 2020/10/12 16:41:03 deraadt Exp $
+.\" $OpenBSD: clang-local.1,v 1.22 2021/09/07 17:39:49 semarie Exp $
.\"
.\" Copyright (c) 2016 Pascal Stumpf <pascal@stumpf.co>
.\"
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\"
-.Dd $Mdocdate: October 12 2020 $
+.Dd $Mdocdate: September 7 2021 $
.Dt CLANG-LOCAL 1
.Os
.Sh NAME
enabled by default on amd64 to protect against branch target injection attacks.
It can be disabled with
.Fl mno-retpoline .
+.It
+A new warning for
+.Cm %n
+format specifier usage in
+.Xr printf 3
+family functions has been added.
.El
.Sh SEE ALSO
.Xr clang 1