mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 08:08:19 +00:00
Fix missing format string that caused some segfaults (v2)
My previous fix wasn't enough.
This commit is contained in:
parent
b6923dc55a
commit
a9155aceb2
2 changed files with 13 additions and 11 deletions
|
@ -121,7 +121,7 @@ void Reporter::Syslog(const char* fmt, ...)
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Reporter::WeirdHelper(EventHandlerPtr event, Val* conn_val, const char* name, const char* addl, ...)
|
void Reporter::WeirdHelper(EventHandlerPtr event, Val* conn_val, const char* addl, const char* fmt_name, ...)
|
||||||
{
|
{
|
||||||
val_list* vl = new val_list(1);
|
val_list* vl = new val_list(1);
|
||||||
|
|
||||||
|
@ -132,22 +132,22 @@ void Reporter::WeirdHelper(EventHandlerPtr event, Val* conn_val, const char* nam
|
||||||
vl->append(new StringVal(addl));
|
vl->append(new StringVal(addl));
|
||||||
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, addl);
|
va_start(ap, fmt_name);
|
||||||
DoLog("weird", event, stderr, 0, vl, false, false, name, ap);
|
DoLog("weird", event, stderr, 0, vl, false, false, fmt_name, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
delete vl;
|
delete vl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Reporter::WeirdFlowHelper(const uint32* orig, const uint32* resp, const char* name, ...)
|
void Reporter::WeirdFlowHelper(const uint32* orig, const uint32* resp, const char* fmt_name, ...)
|
||||||
{
|
{
|
||||||
val_list* vl = new val_list(2);
|
val_list* vl = new val_list(2);
|
||||||
vl->append(new AddrVal(orig));
|
vl->append(new AddrVal(orig));
|
||||||
vl->append(new AddrVal(resp));
|
vl->append(new AddrVal(resp));
|
||||||
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, name);
|
va_start(ap, fmt_name);
|
||||||
DoLog("weird", flow_weird, stderr, 0, vl, false, false, name, ap);
|
DoLog("weird", flow_weird, stderr, 0, vl, false, false, fmt_name, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
delete vl;
|
delete vl;
|
||||||
|
@ -155,17 +155,17 @@ void Reporter::WeirdFlowHelper(const uint32* orig, const uint32* resp, const cha
|
||||||
|
|
||||||
void Reporter::Weird(const char* name)
|
void Reporter::Weird(const char* name)
|
||||||
{
|
{
|
||||||
WeirdHelper(net_weird, 0, name, 0);
|
WeirdHelper(net_weird, 0, 0, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Reporter::Weird(Connection* conn, const char* name, const char* addl)
|
void Reporter::Weird(Connection* conn, const char* name, const char* addl)
|
||||||
{
|
{
|
||||||
WeirdHelper(conn_weird, conn->BuildConnVal(), name, "%s", addl);
|
WeirdHelper(conn_weird, conn->BuildConnVal(), addl, "%s", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Reporter::Weird(Val* conn_val, const char* name, const char* addl)
|
void Reporter::Weird(Val* conn_val, const char* name, const char* addl)
|
||||||
{
|
{
|
||||||
WeirdHelper(conn_weird, conn_val, name, "%s", addl);
|
WeirdHelper(conn_weird, conn_val, addl, "%s", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Reporter::Weird(const uint32* orig, const uint32* resp, const char* name)
|
void Reporter::Weird(const uint32* orig, const uint32* resp, const char* name)
|
||||||
|
|
|
@ -89,8 +89,10 @@ public:
|
||||||
private:
|
private:
|
||||||
void DoLog(const char* prefix, EventHandlerPtr event, FILE* out, Connection* conn, val_list* addl, bool location, bool time, const char* fmt, va_list ap);
|
void DoLog(const char* prefix, EventHandlerPtr event, FILE* out, Connection* conn, val_list* addl, bool location, bool time, const char* fmt, va_list ap);
|
||||||
|
|
||||||
void WeirdHelper(EventHandlerPtr event, Val* conn_val, const char* name, const char* addl, ...);
|
// The order if addl, name needs to be like that since fmt_name can
|
||||||
void WeirdFlowHelper(const uint32* orig, const uint32* resp, const char* name, ...);
|
// contain format specifiers
|
||||||
|
void WeirdHelper(EventHandlerPtr event, Val* conn_val, const char* addl, const char* fmt_name, ...);
|
||||||
|
void WeirdFlowHelper(const uint32* orig, const uint32* resp, const char* fmt_name, ...);
|
||||||
|
|
||||||
int errors;
|
int errors;
|
||||||
bool via_events;
|
bool via_events;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue