com php-src: We shouldn't modify strings in-place (it may be interned strings stored in SHN): ext/pdo/pdo_dbh.c

From: Date: Wed, 07 May 2014 19:19:28 +0000
Subject: com php-src: We shouldn't modify strings in-place (it may be interned strings stored in SHN): ext/pdo/pdo_dbh.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-78192@lists.php.net to get a copy of this message
Commit: 223df9ceea08a9b186f320114e40914552f48716 Author: Dmitry Stogov <dmitry@zend.com> Wed, 7 May 2014 23:19:28 +0400 Parents: d41d6cf20670f1ff555db1ee5523c45b0f0c83fc Branches: phpng Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=223df9ceea08a9b186f320114e40914552f48716 Log: We shouldn't modify strings in-place (it may be interned strings stored in SHN) Changed paths: M ext/pdo/pdo_dbh.c Diff: diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index c5b2b9f..da39634 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -208,7 +208,6 @@ static PHP_METHOD(PDO, dbh_constructor) zval *options = NULL; char alt_dsn[512]; int call_factory = 1; - char tmp; if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!s!a!", &data_source, &data_source_len, &username, &usernamelen, &password, &passwordlen, &options)) { @@ -256,10 +255,8 @@ static PHP_METHOD(PDO, dbh_constructor) } } - tmp = data_source[colon - data_source]; - data_source[colon - data_source] = '\0'; driver = pdo_find_driver(data_source, colon - data_source); - data_source[colon - data_source] = tmp; + if (!driver) { /* NB: don't want to include the data_source in the error message as * it might contain a password */

« previous php.cvs (#78192) next »