From: Eric Wong Date: Tue, 7 Sep 2021 14:05:48 +0000 (+0000) Subject: news_www: avoid uninitialized variables X-Git-Tag: v1.7.0~437 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=083568c68cf37e945c95cd238a9beae1faad9bea;p=public-inbox.git news_www: avoid uninitialized variables 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. --- 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)) {