mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2025-12-23 22:37:53 -05:00
Add quotes around dbUser and dbPass to prevent command injection
This commit is contained in:
@@ -103,7 +103,9 @@ GetOptions(
|
||||
) or pod2usage(-exitstatus => -1);
|
||||
|
||||
$Config{ZM_DB_USER} = $dbUser;
|
||||
$dbUser =~ s/'/\\'/g;
|
||||
$Config{ZM_DB_PASS} = $dbPass;
|
||||
$dbPass =~ s/'/\\'/g;
|
||||
|
||||
if ( $version ) {
|
||||
print( ZoneMinder::Base::ZM_VERSION . "\n");
|
||||
@@ -345,9 +347,9 @@ sub exportsql {
|
||||
my $command = 'mysqldump -t --skip-opt --compact -h'.$host;
|
||||
$command .= ' -P'.$port if defined($port);
|
||||
if ( $dbUser ) {
|
||||
$command .= ' -u'.$dbUser;
|
||||
$command .= ' -u\''.$dbUser.'\'';
|
||||
if ( $dbPass ) {
|
||||
$command .= ' -p'.$dbPass;
|
||||
$command .= ' -p\''.$dbPass.'\'';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user