Skip to content

Commit 3bdeef5

Browse files
authored
Moved null-byte fix from lib/Zend to lib/Magento (#2807)
1 parent f989cf8 commit 3bdeef5

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/Magento/Db/Adapter/Pdo/Mysql.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,10 @@ protected function _quote($value)
113113
$value = $this->_convertFloat($value);
114114
return $value;
115115
}
116-
116+
// Fix for null-byte injection
117+
if (is_string($value)) {
118+
$value = addcslashes($value, "\000\032");
119+
}
117120
return parent::_quote($value);
118121
}
119122

lib/Zend/Db/Adapter/Pdo/Abstract.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,10 +292,8 @@ protected function _quote($value)
292292
if (is_int($value) || is_float($value)) {
293293
return $value;
294294
}
295-
// Fix for null-byte injection
296-
$value = addcslashes($value, "\000\032");
297295
$this->_connect();
298-
return $this->_connection->quote($value);
296+
return $this->_connection->quote((string) $value);
299297
}
300298

301299
/**

0 commit comments

Comments
 (0)