From: Viktor Szakats Date: Mon, 29 Sep 2025 23:46:33 +0000 (+0200) Subject: checksrc: fix possible endless loop when detecting `BANNEDFUNC` X-Git-Tag: rc-8_17_0-2~316 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dd37d6970cfd8b4cf47ebd469f03772813b92c23;p=thirdparty%2Fcurl.git checksrc: fix possible endless loop when detecting `BANNEDFUNC` If the source line had square brackets before the match, the stripping of the banned function left the original line intact, and repeated the check on it forever. E.g. with banned function `open` in `lib518.c`: ```c t518_testfd[0] = open(DEV_NULL, O_RDONLY); ``` Closes #18775 --- diff --git a/scripts/checksrc.pl b/scripts/checksrc.pl index b737961899..23c9ef5301 100755 --- a/scripts/checksrc.pl +++ b/scripts/checksrc.pl @@ -902,6 +902,8 @@ sub scanfile { "use of $bad is banned"); my $replace = 'x' x (length($bad) + 1); $prefix =~ s/\*/\\*/; + $prefix =~ s/\[/\\[/; + $prefix =~ s/\]/\\]/; $suff =~ s/\(/\\(/; $l =~ s/$prefix$bad$suff/$prefix$replace/; goto again;