mirror of
https://github.com/zeek/zeek.git
synced 2025-10-16 05:28:20 +00:00
SMTP: Reject BDAT chunks larger than int64_t's max value
The ContentLine analyzer does not support uint64_t.
This commit is contained in:
parent
638e8a0519
commit
0318ddbee9
1 changed files with 10 additions and 0 deletions
|
@ -5,6 +5,7 @@
|
|||
#include "zeek/zeek-config.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <limits>
|
||||
|
||||
#include "zeek/Event.h"
|
||||
#include "zeek/NetVar.h"
|
||||
|
@ -857,6 +858,15 @@ bool SMTP_Analyzer::ProcessBdatArg(int arg_len, const char* arg, bool orig) {
|
|||
return false;
|
||||
}
|
||||
|
||||
// The ContentLine analyzer only supports int64_t, but BDAT could deal
|
||||
// with uint64_t sized chunks. Weird if the chunk size is larger and
|
||||
// do not configure the ContentLine analyzer for plain delivery.
|
||||
if ( chunk_size > std::numeric_limits<int64_t>::max() ) {
|
||||
const char* addl = zeek::util::fmt("%" PRIu64, chunk_size);
|
||||
Weird("smtp_huge_bdat_chunk", addl);
|
||||
return false;
|
||||
}
|
||||
|
||||
auto* cl = orig ? cl_orig : cl_resp;
|
||||
cl->SetPlainDelivery(chunk_size);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue