From: Wietse Venema Date: Sun, 11 Apr 2021 05:00:00 +0000 (-0500) Subject: postfix-3.2.22 X-Git-Tag: v3.2.22^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=44cefb644c99aab7bc214834f4ee25b673758b95;p=thirdparty%2Fpostfix.git postfix-3.2.22 --- diff --git a/postfix/HISTORY b/postfix/HISTORY index 62a68c260..ffc1f5094 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -23430,3 +23430,17 @@ Apologies for any names omitted. "dane" when smtp_tls_security_level is "dane", otherwise it is "may". File: global/mail_params.h. +20210411 + + Null pointer bug (introduced: Postfix 3.0) after an inline: + table syntax error in main.cf or master.cf. Found by Coverity, + reported by Jaroslav Skarvada. Based on fix by Viktor + Dukhovni. File: util/dict_inline.c. + + Incomplete null pointer check (introduced: Postfix 2.10) + after truncated HaProxy version 1 handshake message. Found + by Coverity, reported by Jaroslav Skarvada. Fix by Viktor + Dukhovni. File: global/haproxy_srvr.c. + + Missing null pointer check (introduced: Postfix alpha) after + null argv[0] value. File: global/mail_task.c. diff --git a/postfix/src/global/haproxy_srvr.c b/postfix/src/global/haproxy_srvr.c index db3d0c1da..9779985d8 100644 --- a/postfix/src/global/haproxy_srvr.c +++ b/postfix/src/global/haproxy_srvr.c @@ -59,6 +59,8 @@ static INET_PROTO_INFO *proto_info; +#define STR_OR_NULL(str) ((str) ? (str) : "(null)") + /* haproxy_srvr_parse_lit - extract and validate string literal */ static int haproxy_srvr_parse_lit(const char *str,...) @@ -68,7 +70,7 @@ static int haproxy_srvr_parse_lit(const char *str,...) int result = -1; if (msg_verbose) - msg_info("haproxy_srvr_parse: %s", str); + msg_info("haproxy_srvr_parse: %s", STR_OR_NULL(str)); if (str != 0) { va_start(ap, str); @@ -85,8 +87,10 @@ static int haproxy_srvr_parse_lit(const char *str,...) static int haproxy_srvr_parse_proto(const char *str, int *addr_family) { if (msg_verbose) - msg_info("haproxy_srvr_parse: proto=%s", str); + msg_info("haproxy_srvr_parse: proto=%s", STR_OR_NULL(str)); + if (str == 0) + return (-1); #ifdef AF_INET6 if (strcasecmp(str, "TCP6") == 0) { if (strchr((char *) proto_info->sa_family_list, AF_INET6) != 0) { @@ -110,7 +114,8 @@ static int haproxy_srvr_parse_addr(const char *str, MAI_HOSTADDR_STR *addr, int addr_family) { if (msg_verbose) - msg_info("haproxy_srvr_parse: addr=%s proto=%d", str, addr_family); + msg_info("haproxy_srvr_parse: addr=%s proto=%d", + STR_OR_NULL(str), addr_family); if (str == 0 || strlen(str) >= sizeof(MAI_HOSTADDR_STR)) return (-1); @@ -145,7 +150,7 @@ static int haproxy_srvr_parse_addr(const char *str, MAI_HOSTADDR_STR *addr, static int haproxy_srvr_parse_port(const char *str, MAI_SERVPORT_STR *port) { if (msg_verbose) - msg_info("haproxy_srvr_parse: port=%s", str); + msg_info("haproxy_srvr_parse: port=%s", STR_OR_NULL(str)); if (str == 0 || strlen(str) >= sizeof(MAI_SERVPORT_STR) || !valid_hostport(str, DONT_GRIPE)) { return (-1); diff --git a/postfix/src/global/mail_task.c b/postfix/src/global/mail_task.c index b1df611d4..893c338c1 100644 --- a/postfix/src/global/mail_task.c +++ b/postfix/src/global/mail_task.c @@ -52,6 +52,8 @@ const char *mail_task(const char *argv0) const char *slash; const char *tag; + if (argv0 == 0) + argv0 = "unknown"; if (canon_name == 0) canon_name = vstring_alloc(10); if ((slash = strrchr(argv0, '/')) != 0 && slash[1]) diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 8932334e5..3c52722cc 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,8 +20,8 @@ * Patches change both the patchlevel and the release date. Snapshots have no * patchlevel; they change the release date only. */ -#define MAIL_RELEASE_DATE "20210117" -#define MAIL_VERSION_NUMBER "3.2.21" +#define MAIL_RELEASE_DATE "20210411" +#define MAIL_VERSION_NUMBER "3.2.22" #ifdef SNAPSHOT #define MAIL_VERSION_DATE "-" MAIL_RELEASE_DATE diff --git a/postfix/src/util/dict_inline.c b/postfix/src/util/dict_inline.c index 667ae8f9d..c87919e9c 100644 --- a/postfix/src/util/dict_inline.c +++ b/postfix/src/util/dict_inline.c @@ -108,9 +108,9 @@ DICT *dict_inline_open(const char *name, int open_flags, int dict_flags) dict = dict_open3(DICT_TYPE_HT, name, open_flags, dict_flags); dict_type_override(dict, DICT_TYPE_INLINE); while ((nameval = mystrtokq(&cp, CHARS_COMMA_SP, CHARS_BRACE)) != 0) { - if ((nameval[0] != CHARS_BRACE[0] - || (err = xperr = extpar(&nameval, CHARS_BRACE, EXTPAR_FLAG_STRIP)) == 0) - && (err = split_qnameval(nameval, &vname, &value)) != 0) + if (nameval[0] == CHARS_BRACE[0]) + err = xperr = extpar(&nameval, CHARS_BRACE, EXTPAR_FLAG_STRIP); + if (err != 0 || (err = split_qnameval(nameval, &vname, &value)) != 0) break; /* No duplicate checks. See comments in dict_thash.c. */