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-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,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 301301FC9E for ; Sun, 19 Sep 2021 12:50:37 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 15/16] net_reader: disallow imap.fetchBatchSize=0 Date: Sun, 19 Sep 2021 12:50:34 +0000 Message-Id: <20210919125035.6331-16-e@80x24.org> In-Reply-To: <20210919125035.6331-1-e@80x24.org> References: <20210919125035.6331-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: A batch size of zero is nonsensical and causes infinite loops. --- lib/PublicInbox/NetReader.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/NetReader.pm b/lib/PublicInbox/NetReader.pm index e305523e..fbe1ac4f 100644 --- a/lib/PublicInbox/NetReader.pm +++ b/lib/PublicInbox/NetReader.pm @@ -344,10 +344,10 @@ sub imap_common_init ($;$) { } my $k = 'imap.fetchBatchSize'; my $bs = $cfg->urlmatch($k, $$uri) // next; - if ($bs =~ /\A([0-9]+)\z/) { + if ($bs =~ /\A([0-9]+)\z/ && $bs > 0) { $self->{cfg_opt}->{$sec}->{batch_size} = $bs; } else { - warn "$k=$bs is not an integer\n"; + warn "$k=$bs is not a positive integer\n"; } } # make sure we can connect and cache the credentials in memory