From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 7A4DC1F4B4 for ; Tue, 5 Jan 2021 18:19:48 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] imap: fix uninitialized var on MSN search miss Date: Tue, 5 Jan 2021 18:19:48 +0000 Message-Id: <20210105181948.4338-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: It seems only triggered by bots trying to steal information. --- lib/PublicInbox/IMAP.pm | 2 +- t/imapd.t | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/IMAP.pm b/lib/PublicInbox/IMAP.pm index 68a7e050..226e98a2 100644 --- a/lib/PublicInbox/IMAP.pm +++ b/lib/PublicInbox/IMAP.pm @@ -1142,7 +1142,7 @@ sub search_common { }; my $mset = $srch->mset($q, $opt); my $uids = $srch->mset_to_artnums($mset, $opt); - msn_convert($self, $uids) if $want_msn; + msn_convert($self, $uids) if scalar(@$uids) && $want_msn; "* SEARCH @$uids\r\n$tag OK Search done\r\n"; } else { "$tag BAD Error\r\n"; diff --git a/t/imapd.t b/t/imapd.t index 5d610dfd..1df9d26e 100644 --- a/t/imapd.t +++ b/t/imapd.t @@ -371,11 +371,13 @@ is(scalar keys %$ret, 3, 'got all 3 messages'); SKIP: { # do any clients use non-UID IMAP SEARCH? - skip 'Xapian missing', 2 if $level eq 'basic'; + skip 'Xapian missing', 3 if $level eq 'basic'; my $x = $mic->search('all'); is_deeply($x, [1, 2, 3], 'MSN SEARCH works before rm'); $x = $mic->search(qw(header subject embedded)); is_deeply($x, [2], 'MSN SEARCH on Subject works before rm'); + $x = $mic->search('FROM scraper@example.com'); + is_deeply($x, [], "MSN SEARCH miss won't trigger warnings"); } {