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 0989A1F8C6 for ; Tue, 7 Sep 2021 14:05:49 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] news_www: avoid uninitialized variables Date: Tue, 7 Sep 2021 14:05:48 +0000 Message-Id: <20210907140548.1682-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: PATH_INFO may not have enough slashes for newsgroup name in the URL at all, so ensure we don't try to further process requests which have no chance of having a newsgroup name. --- lib/PublicInbox/NewsWWW.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/PublicInbox/NewsWWW.pm b/lib/PublicInbox/NewsWWW.pm index d7dd637f..abafc4f9 100644 --- a/lib/PublicInbox/NewsWWW.pm +++ b/lib/PublicInbox/NewsWWW.pm @@ -45,6 +45,8 @@ sub call { # some links may have the article number in them: # /inbox.foo.bar/123456 my (undef, @parts) = split(m!/!, $env->{PATH_INFO}); + @parts or return + [ 404, [qw(Content-Type text/plain)], ["404 Not Found\n"] ]; my ($ng, $article) = @parts; my $pi_cfg = $self->{pi_cfg}; if (my $ibx = $pi_cfg->lookup_newsgroup($ng)) {