mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 07:38:19 +00:00
Add argument checking to a few more printf-style calls.
This commit is contained in:
parent
697b68ab01
commit
bfdce4d419
7 changed files with 9 additions and 9 deletions
|
@ -54,7 +54,7 @@ public:
|
||||||
void TraceOn();
|
void TraceOn();
|
||||||
void TraceOff();
|
void TraceOff();
|
||||||
|
|
||||||
int LogTrace(const char* fmt, ...);
|
int LogTrace(const char* fmt, ...) __attribute__((format(printf, 2, 3)));;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool dbgtrace; // print an execution trace
|
bool dbgtrace; // print an execution trace
|
||||||
|
|
|
@ -221,7 +221,7 @@ void Reporter::WeirdFlowHelper(const IPAddr& orig, const IPAddr& resp, const cha
|
||||||
|
|
||||||
void Reporter::Weird(const char* name)
|
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)
|
void Reporter::Weird(Connection* conn, const char* name, const char* addl)
|
||||||
|
|
|
@ -93,7 +93,7 @@ public:
|
||||||
|
|
||||||
// Report an analyzer error. That analyzer will be set to not process
|
// Report an analyzer error. That analyzer will be set to not process
|
||||||
// any further input, but Bro otherwise continues normally.
|
// 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
|
// Toggle whether non-fatal messages should be reported through the
|
||||||
// scripting layer rather on standard output. Fatal errors are always
|
// 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
|
// The order if addl, name needs to be like that since fmt_name can
|
||||||
// contain format specifiers
|
// contain format specifiers
|
||||||
void WeirdHelper(EventHandlerPtr event, Val* conn_val, const char* addl, 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, ...);
|
void WeirdFlowHelper(const IPAddr& orig, const IPAddr& resp, const char* fmt_name, ...) __attribute__((format(printf, 4, 5)));;
|
||||||
|
|
||||||
int errors;
|
int errors;
|
||||||
bool via_events;
|
bool via_events;
|
||||||
|
|
|
@ -526,7 +526,7 @@ void Raw::WriteToStdin()
|
||||||
|
|
||||||
if ( errno != 0 && errno != EAGAIN && errno != EWOULDBLOCK )
|
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;
|
stdin_towrite = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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");
|
ReaderInfo::config_map::const_iterator it = info.config.find("query");
|
||||||
if ( it == info.config.end() )
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -174,7 +174,7 @@ bool SQLite::DoInit(const WriterInfo& info, int arg_num_fields,
|
||||||
string type = GetTableType(field->type, field->subtype);
|
string type = GetTableType(field->type, field->subtype);
|
||||||
if ( type == "" )
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ public:
|
||||||
* This is safe to call from Run() but must not be used from any
|
* This is safe to call from Run() but must not be used from any
|
||||||
* other thread than the current one.
|
* 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
|
* A version of strerror() that the thread can safely use. This is
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue