Skip to content

Commit

Permalink
firewall: off-by-one in regex for target port range parse
Browse files Browse the repository at this point in the history
  • Loading branch information
fichtner committed Oct 13, 2022
1 parent 8d50193 commit edd0d25
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/www/firewall_nat.php
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ function delete_id($id, &$array)
<?php
$localport = $natent['local-port'];
if (strpos($natent['destination']['port'],'-') !== false) {
$natlocalport = preg_match('/^(\d){1,4}$/', $natent['local-port']) ? (int)$natent['local-port'] : 1;
$natlocalport = preg_match('/^(\d){1,5}$/', $natent['local-port']) ? (int)$natent['local-port'] : 1;
list($dstbeginport, $dstendport) = explode("-", $natent['destination']['port']);
$dstbeginport = preg_match('/^\d*$/', $dstbeginport) ? (int)$dstbeginport : 1;
$dstendport = preg_match('/^\d*$/', $dstendport) ? (int)$dstendport : 65535;
Expand Down

0 comments on commit edd0d25

Please sign in to comment.