checksrc: fix to handle ) predecing a banned function

Fixing:
```
Unmatched ) in regex; marked by <-- HERE in m/  \*buffer_len = \(ssize_t) <-- HERE
  strtol\(/ at /home/runner/work/curl/curl/scripts/checksrc.pl line 916, <$R> line 380.
```
Ref: https://github.com/curl/curl/actions/runs/18209824275/job/51848079550#step:3:5

Also add a test case.

Follow-up to 684f4cdd3e #18779
Cherry-picked from #18823
Closes #18836
This commit is contained in:
Viktor Szakats 2025-10-03 03:12:39 +02:00
parent 99433d06e6
commit fff36a360e
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
2 changed files with 7 additions and 2 deletions

View file

@ -908,6 +908,7 @@ sub scanfile {
$prefix =~ s/\[/\\[/;
$prefix =~ s/\]/\\]/;
$prefix =~ s/\(/\\(/;
$prefix =~ s/\)/\\)/;
$suff =~ s/\(/\\(/;
$l =~ s/$prefix$bad$suff/$prefix$replace/;
goto again;