From 0e216c5f7cc9d6fd3d3ad6909eb071fb399ee4c8 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 23 Jan 2014 22:12:07 +0100 Subject: BUG: don't segfault when double LF is missing at the end of the message strstr("\n\n") is not guaranteed to succeed... --- nbsmtp.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nbsmtp.c b/nbsmtp.c index 7b6fba2..e8f51f2 100644 --- a/nbsmtp.c +++ b/nbsmtp.c @@ -163,6 +163,11 @@ int nbsmtp_data(servinfo_t *serverinfo, string_t *msg) } msg_tmp = (char *) strstr(msg->str, "\n\n"); + if (msg_tmp == NULL) { + log_msg(LOG_ERR,"Double line feed not found at the end of the message"); + return -1; + } + msg_tmp += 2; *msg_tmp = '\0'; -- 1.7.12.1