mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-05-18 19:46:12 -04:00
Fix usage of unset variable
If daemon or args are unset the preg_replace is never called which can result in count not having a value when referenced in the if statement. This generates a warning in error.log.
This commit is contained in:
@@ -7,6 +7,7 @@ class HostController extends AppController {
|
||||
|
||||
public function daemonCheck($daemon=false, $args=false) {
|
||||
# To try to prevent abuse here, we are only going to allow certain characters in the daemon and args.
|
||||
$count = 0;
|
||||
$safe_daemon = $daemon ? preg_replace('/[^A-Za-z0-9\- \.]/', '', $daemon, -1, $count) : false;
|
||||
if ($count) Error("Invalid characters found in daemon string ($daemon). Potential attack?");
|
||||
$safe_args = $args ? preg_replace('/[^A-Za-z0-9\- \.]/', '', $args, -1, $count) : false;
|
||||
|
||||
Reference in New Issue
Block a user