SMTP: Reset ContentLineAnalyzer plain delivery on EndData()

When resetting the BDAT state, we also need to switch the ContentLine
analyzer back into line mode, otherwise we're feeding plain delivery
data through ProcessLine(), possibly violating some assumptions about
null termination.

Do it for both ContentLineAnalyzers - only one of them will be in plain
delivery mode anyhow, but we don't keep state which one it was.
This commit is contained in:
Arne Welzel 2024-01-23 15:38:24 +01:00
parent 9a510b8035
commit bc357c6ca1

View file

@ -899,6 +899,12 @@ void SMTP_Analyzer::BeginData(bool orig, detail::SMTP_State new_state) {
void SMTP_Analyzer::EndData() { void SMTP_Analyzer::EndData() {
if ( bdat ) { if ( bdat ) {
if ( bdat->RemainingChunkSize() > 0 ) {
Weird("smtp_bdat_remaining_at_end_data");
cl_orig->SetPlainDelivery(0);
cl_resp->SetPlainDelivery(0);
}
bdat->Done(); bdat->Done();
bdat.reset(); bdat.reset();
} }