]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei: always use 3-arg open perlop
authorEric Wong <e@80x24.org>
Mon, 22 Nov 2021 18:38:09 +0000 (18:38 +0000)
committerEric Wong <e@80x24.org>
Mon, 22 Nov 2021 21:36:50 +0000 (21:36 +0000)
Future-proofing in case future versions of Perl warn on this, since
2-arg forms of open may be subject to injection vulnerabilities
with non-literal args.

lib/PublicInbox/LEI.pm

index 192f267ca1dd4611ce41afb0b913878151982c06..4e0295fa4e8a18200aa67719b3281add5b5a696e 100644 (file)
@@ -818,7 +818,8 @@ sub dispatch {
                                next if $d eq ''; # same as git(1)
                                chdir $d or return fail($self, "cd $d: $!");
                        }
-                       open $self->{3}, '.' or return fail($self, "open . $!");
+                       open $self->{3}, '<', '.' or
+                               return fail($self, "open . $!");
                }
                $cb->($self, @argv);
        } elsif (grep(/\A-/, $cmd, @argv)) { # --help or -h only