From 4c38b5732e8927440acb4d2f3685e4661d7eded4 Mon Sep 17 00:00:00 2001 From: Kevin Adams Date: Fri, 15 May 2026 14:27:02 -0400 Subject: [PATCH] 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 --- perl5/PVE/Storage/LunCmd/FreeNAS.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perl5/PVE/Storage/LunCmd/FreeNAS.pm b/perl5/PVE/Storage/LunCmd/FreeNAS.pm index 6548afa..80efc16 100644 --- a/perl5/PVE/Storage/LunCmd/FreeNAS.pm +++ b/perl5/PVE/Storage/LunCmd/FreeNAS.pm @@ -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."; }