From 99a4bf4819cea7d093b8740aabd3e029cf50c81f Mon Sep 17 00:00:00 2001 From: Janos SUTO Date: Mon, 4 Jan 2021 15:57:45 +0100 Subject: [PATCH] Discard header-only message without a Message-ID line Signed-off-by: Janos SUTO --- src/piler.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/piler.c b/src/piler.c index 684d90de..d26016cf 100644 --- a/src/piler.c +++ b/src/piler.c @@ -123,9 +123,13 @@ int perform_checks(char *filename, struct session_data *sdata, struct data *data make_digests(sdata, cfg); + // A normal header is much bigger than 10 bytes. We get here for header-only + // messages without a Message-ID: line. I believe that no such message is valid, and + // it's a reasonable to discard it, and not allowing it to fill up the error directory. + if(sdata->hdr_len < 10){ - syslog(LOG_PRIORITY, "%s: invalid message, hdr_len: %d", filename, sdata->hdr_len); - return ERR; + syslog(LOG_PRIORITY, "%s: discarding: a header-only message without a Message-ID line", filename); + return ERR_DISCARDED; } int rc = process_message(sdata, parser_state, data, cfg);