diff --git a/src/Debug.h b/src/Debug.h index a83e05c224..89884cfb0b 100644 --- a/src/Debug.h +++ b/src/Debug.h @@ -54,7 +54,7 @@ public: void TraceOn(); void TraceOff(); - int LogTrace(const char* fmt, ...); + int LogTrace(const char* fmt, ...) __attribute__((format(printf, 2, 3)));; protected: bool dbgtrace; // print an execution trace diff --git a/src/Reporter.cc b/src/Reporter.cc index e5a37bf13b..cbd8402c9d 100644 --- a/src/Reporter.cc +++ b/src/Reporter.cc @@ -221,7 +221,7 @@ void Reporter::WeirdFlowHelper(const IPAddr& orig, const IPAddr& resp, const cha void Reporter::Weird(const char* name) { - WeirdHelper(net_weird, 0, 0, name); + WeirdHelper(net_weird, 0, 0, "%s", name); } void Reporter::Weird(Connection* conn, const char* name, const char* addl) diff --git a/src/Reporter.h b/src/Reporter.h index b9ba4f1b95..19cdbb7e82 100644 --- a/src/Reporter.h +++ b/src/Reporter.h @@ -93,7 +93,7 @@ public: // Report an analyzer error. That analyzer will be set to not process // any further input, but Bro otherwise continues normally. - void AnalyzerError(analyzer::Analyzer* a, const char* fmt, ...); + void AnalyzerError(analyzer::Analyzer* a, const char* fmt, ...) __attribute__((format(printf, 3, 4)));; // Toggle whether non-fatal messages should be reported through the // scripting layer rather on standard output. Fatal errors are always @@ -127,8 +127,8 @@ private: // The order if addl, name needs to be like that since fmt_name can // contain format specifiers - void WeirdHelper(EventHandlerPtr event, Val* conn_val, const char* addl, const char* fmt_name, ...); - void WeirdFlowHelper(const IPAddr& orig, const IPAddr& resp, const char* fmt_name, ...); + void WeirdHelper(EventHandlerPtr event, Val* conn_val, const char* addl, const char* fmt_name, ...) __attribute__((format(printf, 5, 6)));; + void WeirdFlowHelper(const IPAddr& orig, const IPAddr& resp, const char* fmt_name, ...) __attribute__((format(printf, 4, 5)));; int errors; bool via_events; diff --git a/src/input/readers/raw/Raw.cc b/src/input/readers/raw/Raw.cc index 843d1d25d1..cfa7b72602 100644 --- a/src/input/readers/raw/Raw.cc +++ b/src/input/readers/raw/Raw.cc @@ -526,7 +526,7 @@ void Raw::WriteToStdin() if ( errno != 0 && errno != EAGAIN && errno != EWOULDBLOCK ) { - Error(Fmt("Writing to child process stdin failed: %d. Stopping writing at position %d", errno, pos)); + Error(Fmt("Writing to child process stdin failed: %d. Stopping writing at position %" PRIu64, errno, pos)); stdin_towrite = 0; } diff --git a/src/input/readers/sqlite/SQLite.cc b/src/input/readers/sqlite/SQLite.cc index 47e8cc3ed7..c970e60182 100644 --- a/src/input/readers/sqlite/SQLite.cc +++ b/src/input/readers/sqlite/SQLite.cc @@ -94,7 +94,7 @@ bool SQLite::DoInit(const ReaderInfo& info, int arg_num_fields, const threading: ReaderInfo::config_map::const_iterator it = info.config.find("query"); if ( it == info.config.end() ) { - Error(Fmt("No query specified when setting up SQLite data source. Aborting.", info.source)); + Error(Fmt("No query specified when setting up SQLite data source %s. Aborting.", info.source)); return false; } else diff --git a/src/logging/writers/sqlite/SQLite.cc b/src/logging/writers/sqlite/SQLite.cc index f7b85889f3..977a0c6089 100644 --- a/src/logging/writers/sqlite/SQLite.cc +++ b/src/logging/writers/sqlite/SQLite.cc @@ -174,7 +174,7 @@ bool SQLite::DoInit(const WriterInfo& info, int arg_num_fields, string type = GetTableType(field->type, field->subtype); if ( type == "" ) { - InternalError(Fmt("Could not determine type for field %lu:%s", i, fieldname)); + InternalError(Fmt("Could not determine type for field %u:%s", i, fieldname)); return false; } diff --git a/src/threading/BasicThread.h b/src/threading/BasicThread.h index 117506c418..6386e5ae66 100644 --- a/src/threading/BasicThread.h +++ b/src/threading/BasicThread.h @@ -116,7 +116,7 @@ public: * This is safe to call from Run() but must not be used from any * other thread than the current one. */ - const char* Fmt(const char* format, ...); + const char* Fmt(const char* format, ...) __attribute__((format(printf, 2, 3)));; /** * A version of strerror() that the thread can safely use. This is