Fix regex operator precedence bug in freenas_api_call method guard
'! $method =~ /pattern/' is parsed as '(! $method) =~ /pattern/' due to precedence, so the regex ran against "" and always returned false. The guard never fired and any method string passed through to the API call. Changed to '$method !~ /^(?:GET|DELETE|POST)$/' which correctly tests the method string. Also replaced atomic group (?>...) with non-capturing (?:...) since there is no backtracking concern here. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
43a8efd125
commit
4c38b5732e
|
|
@ -464,7 +464,7 @@ sub freenas_api_call {
|
|||
syslog("info", (caller(0))[3] . " : called for host '" . $apihost . "'");
|
||||
|
||||
$method = uc($method);
|
||||
if (! $method =~ /^(?>GET|DELETE|POST)$/) {
|
||||
if ($method !~ /^(?:GET|DELETE|POST)$/) {
|
||||
syslog("info", (caller(0))[3] . " : Invalid HTTP RESTful service method '$method'");
|
||||
die "Invalid HTTP RESTful service method '$method' used.";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue