unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* [PATCH] imap: fix uninitialized var on MSN search miss
@ 2021-01-05 18:19 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2021-01-05 18:19 UTC (permalink / raw)
  To: meta

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");
 }
 
 {

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-05 18:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-05 18:19 [PATCH] imap: fix uninitialized var on MSN search miss Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).