From 2ca822c6893b67f1c5149c2b9f8a49fb1ca609bf Mon Sep 17 00:00:00 2001 From: Janos SUTO Date: Sun, 4 Mar 2018 20:16:30 +0100 Subject: [PATCH] fix buffering issue introduced with the simplifed handle_data() Signed-off-by: Janos SUTO --- src/config.h | 2 +- src/session.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/config.h b/src/config.h index 8feeb47b..d10be142 100644 --- a/src/config.h +++ b/src/config.h @@ -11,7 +11,7 @@ #define VERSION "1.3.4" -#define BUILD 992 +#define BUILD 993 #define HOSTID "mailarchiver" diff --git a/src/session.c b/src/session.c index e0ef034e..d5b73d0e 100644 --- a/src/session.c +++ b/src/session.c @@ -195,7 +195,9 @@ void handle_data(struct smtp_session *session, char *readbuf, int readlen, struc p += puflen; if(puflen > 0){ - if(session->protocol_state == SMTP_STATE_DATA){ + // pass the puffer to process_data() only if there was an '\n' + // on the line or the puffer does not start with a period + if(session->protocol_state == SMTP_STATE_DATA && (rc == OK || puf[0] != '.')){ process_data(session, puf, puflen); } else if(session->protocol_state == SMTP_STATE_BDAT){