talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 83d08a08ca6c8fa43423e2221b43debe4c655334
parent 5e584dc8515ce4ddb54161f92796f6617b9422b2
Author: Andrej Kacian <ticho@claws-mail.org>
Date:   Wed, 12 Dec 2018 19:43:13 +0100

Handle corner case in news_get_extra_fields() where msglist is empty

This makes the function quit early, instead of requesting
XHDR with bogus ranges from the server.

Closes bug #4133: trying to read message from an NNTP group (with
all expired articles.

Diffstat:
Msrc/news.c | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/news.c b/src/news.c @@ -1125,6 +1125,9 @@ static void news_get_extra_fields(NewsSession *session, FolderItem *item, GSList cm_return_if_fail(item->folder != NULL); cm_return_if_fail(FOLDER_CLASS(item->folder) == &news_class); + if (msglist == NULL) + return; + news_folder_lock(NEWS_FOLDER(item->folder)); hash_table = g_hash_table_new(g_direct_hash, g_direct_equal); @@ -1139,6 +1142,11 @@ static void news_get_extra_fields(NewsSession *session, FolderItem *item, GSList GINT_TO_POINTER(msginfo->msgnum), msginfo); } + if (first == -1 || last == -1) { + g_hash_table_destroy(hash_table); + return; + } + /* Newsgroups */ ok = nntp_threaded_xhdr(item->folder, "newsgroups", first, last, &hdrlist);