Skip to content

Commit

Permalink
Moved null-byte fix from lib/Zend to lib/Magento (#2807)
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel committed Dec 13, 2022
1 parent f989cf8 commit 3bdeef5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 4 additions & 1 deletion lib/Magento/Db/Adapter/Pdo/Mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ protected function _quote($value)
$value = $this->_convertFloat($value);
return $value;
}

// Fix for null-byte injection
if (is_string($value)) {
$value = addcslashes($value, "\000\032");
}
return parent::_quote($value);
}

Expand Down
4 changes: 1 addition & 3 deletions lib/Zend/Db/Adapter/Pdo/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,8 @@ protected function _quote($value)
if (is_int($value) || is_float($value)) {
return $value;
}
// Fix for null-byte injection
$value = addcslashes($value, "\000\032");
$this->_connect();
return $this->_connection->quote($value);
return $this->_connection->quote((string) $value);
}

/**
Expand Down

0 comments on commit 3bdeef5

Please sign in to comment.