Add quotes around dbUser and dbPass to prevent command injection
parent
b39445d5c5
commit
42a284d9ac
|
@ -103,7 +103,9 @@ GetOptions(
|
||||||
) or pod2usage(-exitstatus => -1);
|
) or pod2usage(-exitstatus => -1);
|
||||||
|
|
||||||
$Config{ZM_DB_USER} = $dbUser;
|
$Config{ZM_DB_USER} = $dbUser;
|
||||||
|
$dbUser =~ s/'/\\'/g;
|
||||||
$Config{ZM_DB_PASS} = $dbPass;
|
$Config{ZM_DB_PASS} = $dbPass;
|
||||||
|
$dbPass =~ s/'/\\'/g;
|
||||||
|
|
||||||
if ( $version ) {
|
if ( $version ) {
|
||||||
print( ZoneMinder::Base::ZM_VERSION . "\n");
|
print( ZoneMinder::Base::ZM_VERSION . "\n");
|
||||||
|
@ -345,9 +347,9 @@ sub exportsql {
|
||||||
my $command = 'mysqldump -t --skip-opt --compact -h'.$host;
|
my $command = 'mysqldump -t --skip-opt --compact -h'.$host;
|
||||||
$command .= ' -P'.$port if defined($port);
|
$command .= ' -P'.$port if defined($port);
|
||||||
if ( $dbUser ) {
|
if ( $dbUser ) {
|
||||||
$command .= ' -u'.$dbUser;
|
$command .= ' -u\''.$dbUser.'\'';
|
||||||
if ( $dbPass ) {
|
if ( $dbPass ) {
|
||||||
$command .= ' -p'.$dbPass;
|
$command .= ' -p\''.$dbPass.'\'';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue