mirror of
https://github.com/curl/curl.git
synced 2026-07-16 09:57:16 +03:00
checksrc: catch banned functions when preceded by (
Also add a test case. Closes #18779
This commit is contained in:
parent
c478c7efdf
commit
684f4cdd3e
2 changed files with 10 additions and 3 deletions
|
|
@ -893,7 +893,8 @@ sub scanfile {
|
|||
# scan for use of banned functions
|
||||
my $bl = $l;
|
||||
again:
|
||||
if(($l =~ /^(.*?\W)(\w+)(\s*\()/x) && $banfunc{$2}) {
|
||||
if((($l =~ /^(.*?\W)(\w+)(\s*\()/x) && $banfunc{$2}) ||
|
||||
(($l =~ /^(.*?\()(\w+)(\s*\()/x) && $banfunc{$2})) {
|
||||
my $bad = $2;
|
||||
my $prefix = $1;
|
||||
my $suff = $3;
|
||||
|
|
@ -904,6 +905,7 @@ sub scanfile {
|
|||
$prefix =~ s/\*/\\*/;
|
||||
$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