|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-03-27 08:53 UTC] disbursement at dublin dot com
Description:
------------
static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_DC) /* {{{ */
{
...
struct pdo_data_src_parser vars[] = {
{ "charset", NULL, 0 },
{ "dbname", "", 0 },
{ "host", "localhost", 0 },
{ "port", "3306", 0 },
{ "unix_socket", PDO_MYSQL_UNIX_ADDR, 0 },
};
The option "charset"/vars[0] is never used, but would be a nice feature.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 15:00:01 2025 UTC |
Re-opening this as it has security implications for 5.2.x. It should be backported and re-released as a security fix for 5.2.x. As it stands now, PDO::quote() does not protect against security vulnerabilities without the ability to set the character set in the C api. 5.3.6 closes this hole when supplied with the optional charset parameter (by appropriately setting the character set). However this will need to be expressed in the documentation (I will file another issue on this topic). Proof Of Concept Code: $dsn = 'mysql:dbname=INFORMATION_SCHEMA;host=127.0.0.1;charset=GBK'; $pdo = new PDO($dsn, $user, $pass); $pdo->exec('SET NAMES GBK'); $string = chr(0xbf) . chr(0x27) . ' OR 1 = 1; /*'; $sql = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE ".$pdo->quote($string).";"; $stmt = $pdo->query($sql); var_dump($stmt->rowCount()); Expected: int(0) Actual: the number of tables on the server