]> Sergey Matveev's repositories - public-inbox.git/commitdiff
news_www: avoid uninitialized variables
authorEric Wong <e@80x24.org>
Tue, 7 Sep 2021 14:05:48 +0000 (14:05 +0000)
committerEric Wong <e@80x24.org>
Tue, 7 Sep 2021 21:01:23 +0000 (21:01 +0000)
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

index d7dd637ff8b681e37f0a483148cd860c08bd477c..abafc4f97b22c037bb138f7e6fe0c8d798c48d2d 100644 (file)
@@ -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)) {