diff options
author | Jean-Daniel Dupas <devlists@shadowlab.org> | 2012-02-07 23:10:53 +0000 |
---|---|---|
committer | Jean-Daniel Dupas <devlists@shadowlab.org> | 2012-02-07 23:10:53 +0000 |
commit | 2837a2f02195e624b14b419b2d3e6682a6bc5a0f (patch) | |
tree | eb5224db217fdf43b77de1d380666fd6f1e28edc /lib/Sema/SemaChecking.cpp | |
parent | d08900848307fdaea19d52249bdced94eefdb9bb (diff) |
non-literal strftime format string is not unsafe.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150009 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index c3b957cb60..378930a0e5 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -1584,6 +1584,11 @@ void Sema::CheckFormatArguments(Expr **Args, unsigned NumArgs, format_idx, firstDataArg, Type)) return; // Literal format string found, check done! + // Strftime is particular as it always uses a single 'time' argument, + // so it is safe to pass a non-literal string. + if (Type == FST_Strftime) + return; + // Do not emit diag when the string param is a macro expansion and the // format is either NSString or CFString. This is a hack to prevent // diag when using the NSLocalizedString and CFCopyLocalizedString macros |