From c4c499cb5b9fc35e8b850a9faf6b700feb3b299f Mon Sep 17 00:00:00 2001 From: maminjie Date: Sat, 27 Mar 2021 11:55:31 +0800 Subject: [PATCH] Fix assert-crash if parsing invalid BODYSTRUCTURE with empty Content-Language list reference to: https://github.com/dovecot/core/commit/dd51ae09a8a688c8466e31d5b6108756d5154153 --- src/lib-imap/imap-bodystructure.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib-imap/imap-bodystructure.c b/src/lib-imap/imap-bodystructure.c index a2d778f..b52af28 100644 --- a/src/lib-imap/imap-bodystructure.c +++ b/src/lib-imap/imap-bodystructure.c @@ -245,6 +245,8 @@ imap_bodystructure_strlist_parse(const struct imap_arg *arg, } else { if (!imap_arg_get_list_full(arg, &list_args, &list_count)) return -1; + if (list_count == 0) + return -1; list = p_new(pool, const char *, list_count+1); for (i = 0; i < list_count; i++) { -- 2.23.0