From 3d40543c86fe6debadaa10cc3a075a1e7896cccd Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 11 Nov 2015 14:32:25 +0000 Subject: [PATCH] Fix issues in reading format strings --- clang-plugin/printf_check.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/clang-plugin/printf_check.cc b/clang-plugin/printf_check.cc index 5ebbeef1f..37e8dc399 100644 --- a/clang-plugin/printf_check.cc +++ b/clang-plugin/printf_check.cc @@ -87,7 +87,7 @@ namespace rspamd { }; class PrintfCheckVisitor::impl { - std::unordered_map printf_functions; + std::unordered_map printf_functions; ASTContext *pcontext; std::unique_ptr parseFlags (const std::string &flags) @@ -215,7 +215,13 @@ namespace rspamd { llvm::errs () << "invalid modifier\n"; return nullptr; } - state = ignore_chars; + + if (c == '%') { + state = read_percent; + } + else { + state = ignore_chars; + } } else { flags.push_back (c); -- 2.39.5