gitweb: Exiting subroutine via next at /usr/lib/cgi-bin/gitweb.cgi line 3142
- From
- martin f krafft <madduck@madduck.net>
- Date
- Jan 11, 2024, 08:28 UTC
- Message-ID
- <20240111082802.ilmtwupekkbxqznw@lotus.rw.madduck.net>
Hi team,
I get tens of thousands of messages like
``` [Thu Jan 11 09:01:11 2024] gitweb.cgi: Exiting subroutine via next at /usr/lib/cgi-bin/gitweb.cgi line 3142. ```
in my logs, presumably from crawlers hitting the CGI wrongly. This is using gitweb 2.39.2.
I know no Perl whatsoever, but it's my impression that the following patch would solve this:
``` --- /tmp/gitweb.cgi 2024-01-11 09:07:47.283764508 +0100 +++ /usr/lib/cgi-bin/gitweb.cgi 2024-01-11 09:01:43.459218235 +0100
@@ -3139,7 +3139,7 @@ my $path = substr($File::Find::name, $pfxlen + 1); # paranoidly only filter here if ($paranoid && $filter && $path !~ m!^\Q$filter\E/!) { - next; + return; } # we check related file in $projectroot if (check_export_ok("$projectroot/$path")) { ``` This is within the wanted sub for `File::Find::find`, and it returns next so as to skip the currently visited file during the tree walk. Returning a false value, which `return` without an argument presumably does, should have the same effect. Cheers,
--
martin krafft | https://matrix.to/#/#madduck:madduck.net
"it usually takes more than three weeks
to prepare a good impromptu speech.
-- mark twain
{: .blockquote }
spamtraps: madduck.bogus@madduck.net
{: .hidden }