|
|
baa6c3 |
From dc22d0df73a7ecb036d73cfa1814ddf998ff131b Mon Sep 17 00:00:00 2001
|
|
|
baa6c3 |
From: =?UTF-8?q?Nikola=20Forr=C3=B3?= <nforro@redhat.com>
|
|
|
baa6c3 |
Date: Tue, 17 Jan 2017 14:03:00 +0100
|
|
|
baa6c3 |
Subject: [PATCH] Fix SIGSEGV crash in smtp_auth_var()
|
|
|
baa6c3 |
Add warning message for empty from variable
|
|
|
baa6c3 |
|
|
|
baa6c3 |
---
|
|
|
baa6c3 |
sendout.c | 13 +++++++++++++
|
|
|
baa6c3 |
smtp.c | 5 ++++-
|
|
|
baa6c3 |
2 files changed, 17 insertions(+), 1 deletion(-)
|
|
|
baa6c3 |
|
|
|
baa6c3 |
diff --git a/sendout.c b/sendout.c
|
|
|
baa6c3 |
index c52f15d..f83952a 100644
|
|
|
baa6c3 |
--- a/sendout.c
|
|
|
baa6c3 |
+++ b/sendout.c
|
|
|
baa6c3 |
@@ -966,6 +966,19 @@ mail1(struct header *hp, int printheaders, struct message *quote,
|
|
|
baa6c3 |
return STOP;
|
|
|
baa6c3 |
}
|
|
|
baa6c3 |
#endif
|
|
|
baa6c3 |
+
|
|
|
baa6c3 |
+ /*
|
|
|
baa6c3 |
+ * Variable "from" is set but empty, let user know
|
|
|
baa6c3 |
+ * that something is wrong.
|
|
|
baa6c3 |
+ */
|
|
|
baa6c3 |
+ if ((cp = value("from")) != NULL && !*cp) {
|
|
|
baa6c3 |
+ fprintf(stderr, "From address is empty. ");
|
|
|
baa6c3 |
+ fprintf(stderr, "Check your mail config ");
|
|
|
baa6c3 |
+ fprintf(stderr, "file for typos. E.g. no ");
|
|
|
baa6c3 |
+ fprintf(stderr, "whitespace after set from=");
|
|
|
baa6c3 |
+ fprintf(stderr, "\n");
|
|
|
baa6c3 |
+ }
|
|
|
baa6c3 |
+
|
|
|
baa6c3 |
if ((cp = value("autocc")) != NULL && *cp)
|
|
|
baa6c3 |
hp->h_cc = cat(hp->h_cc, checkaddrs(sextract(cp, GCC|GFULL)));
|
|
|
baa6c3 |
if ((cp = value("autobcc")) != NULL && *cp)
|
|
|
baa6c3 |
diff --git a/smtp.c b/smtp.c
|
|
|
baa6c3 |
index b4561e3..baab5d1 100644
|
|
|
baa6c3 |
--- a/smtp.c
|
|
|
baa6c3 |
+++ b/smtp.c
|
|
|
baa6c3 |
@@ -135,7 +135,7 @@ myaddrs(struct header *hp)
|
|
|
baa6c3 |
if (hp->h_from->n_name)
|
|
|
baa6c3 |
return savestr(hp->h_from->n_name);
|
|
|
baa6c3 |
}
|
|
|
baa6c3 |
- if ((cp = value("from")) != NULL)
|
|
|
baa6c3 |
+ if ((cp = value("from")) != NULL && *cp)
|
|
|
baa6c3 |
return cp;
|
|
|
baa6c3 |
/*
|
|
|
baa6c3 |
* When invoking sendmail directly, it's its task
|
|
|
baa6c3 |
@@ -177,6 +177,9 @@ smtp_auth_var(const char *type, const char *addr)
|
|
|
baa6c3 |
char *var, *cp;
|
|
|
baa6c3 |
int len;
|
|
|
baa6c3 |
|
|
|
baa6c3 |
+ if (type == NULL || addr == NULL)
|
|
|
baa6c3 |
+ return NULL;
|
|
|
baa6c3 |
+
|
|
|
baa6c3 |
var = ac_alloc(len = strlen(type) + strlen(addr) + 7);
|
|
|
baa6c3 |
snprintf(var, len, "smtp-auth%s-%s", type, addr);
|
|
|
baa6c3 |
if ((cp = value(var)) != NULL)
|
|
|
baa6c3 |
--
|
|
|
baa6c3 |
2.7.4
|
|
|
baa6c3 |
|