Project

General

Profile

Actions

Bug #2283

closed

pfblocker array handling when alias table is empty

Added by Phillip Davis over 13 years ago. Updated over 13 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
03/13/2012
Due date:
% Done:

0%

Estimated time:
Plus Target Version:
Affected Version:
2.0.1
Affected Plus Version:
Affected Architecture:

Description

When pfblocker is not enabled or there is nothing setup for pfblocker to do, and there are no other aliases defined in the pfSense alias table, pfblocker.inc sync_package_pfblocker logs a PHP error when trying to process the empty alias table. The "if" test at:

#update pfsense alias table
if (is_array($config['aliases']['alias'])){
$aliases=$config['aliases']['alias'];
foreach($aliases as $cbalias){
...
}
}

needs to be a block that covers both statements above, as shown.
In the existing code the if test only applies itself to the 1 line immediately following it.
Otherwise the "foreach" line logs an error because $aliases is null.
This case applies equally to 2.0.n and 2.1
A sample corrected file is attached.


Files

pfblocker.inc (25.2 KB) pfblocker.inc pfblocker.inc with corrected handling of empty alias table case Phillip Davis, 03/13/2012 07:55 AM
Actions #1

Updated by Phillip Davis over 13 years ago

This was resolved by pull request 225 on 15 Mar 2012

Actions #2

Updated by Chris Buechler over 13 years ago

  • Status changed from New to Resolved
Actions

Also available in: Atom PDF