mirror of
https://github.com/curl/curl.git
synced 2026-06-02 03:24:16 +03:00
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
This commit is contained in:
parent
20142f5d06
commit
dd37d6970c
1 changed files with 2 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue