iliaa Wed, 14 Mar 2012 20:20:33 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=324251
Log: Fixed bug #61212 (PDO ODBC Segfaults on SQL_SUCESS_WITH_INFO). Bug: https://bugs.php.net/61212 (Open) PDO ODBC Segfaults on SQL_SUCESS_WITH_INFO Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/ext/pdo_odbc/odbc_stmt.c U php/php-src/branches/PHP_5_4/NEWS U php/php-src/branches/PHP_5_4/ext/pdo_odbc/odbc_stmt.c U php/php-src/trunk/ext/pdo_odbc/odbc_stmt.c Modified: php/php-src/branches/PHP_5_3/NEWS =================================================================== --- php/php-src/branches/PHP_5_3/NEWS 2012-03-14 20:08:14 UTC (rev 324250) +++ php/php-src/branches/PHP_5_3/NEWS 2012-03-14 20:20:33 UTC (rev 324251) @@ -47,6 +47,9 @@ . Fixed bug #61194 (PDO should export compression flag with myslqnd). (Johannes) +- PDO_odbc + . Fixed bug #61212 (PDO ODBC Segfaults on SQL_SUCESS_WITH_INFO). (Ilia) + - PDO_pgsql . Fixed bug #61267 (pdo_pgsql's PDO::exec() returns the number of SELECTed rows on postgresql >= 9). (ben dot pineau at gmail dot com) Modified: php/php-src/branches/PHP_5_3/ext/pdo_odbc/odbc_stmt.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/pdo_odbc/odbc_stmt.c 2012-03-14 20:08:14 UTC (rev 324250) +++ php/php-src/branches/PHP_5_3/ext/pdo_odbc/odbc_stmt.c 2012-03-14 20:20:33 UTC (rev 324251) @@ -637,12 +637,14 @@ if (C->fetched_len != SQL_NO_TOTAL) { /* use size suggested by the driver, if it knows it */ - alloced = C->fetched_len + 1; + buf = emalloc(C->fetched_len + 1); + memcpy(buf, C->data, C->fetched_len); + buf[C->fetched_len] = 0; + used = C->fetched_len; + } else { + buf = estrndup(C->data, 256); + used = 255; /* not 256; the driver NUL terminated the buffer */ } - - buf = emalloc(alloced); - memcpy(buf, C->data, 256); - used = 255; /* not 256; the driver NUL terminated the buffer */ do { C->fetched_len = 0; Modified: php/php-src/branches/PHP_5_4/NEWS =================================================================== --- php/php-src/branches/PHP_5_4/NEWS 2012-03-14 20:08:14 UTC (rev 324250) +++ php/php-src/branches/PHP_5_4/NEWS 2012-03-14 20:20:33 UTC (rev 324251) @@ -75,6 +75,9 @@ . Fixed bug #61194 (PDO should export compression flag with myslqnd). (Johannes) +- PDO_odbc + . Fixed bug #61212 (PDO ODBC Segfaults on SQL_SUCESS_WITH_INFO). (Ilia) + - Phar . Fixed bug #61184 (Phar::webPhar() generates headers with trailing NUL bytes). (Nikita Popov) Modified: php/php-src/branches/PHP_5_4/ext/pdo_odbc/odbc_stmt.c =================================================================== --- php/php-src/branches/PHP_5_4/ext/pdo_odbc/odbc_stmt.c 2012-03-14 20:08:14 UTC (rev 324250) +++ php/php-src/branches/PHP_5_4/ext/pdo_odbc/odbc_stmt.c 2012-03-14 20:20:33 UTC (rev 324251) @@ -637,12 +637,14 @@ if (C->fetched_len != SQL_NO_TOTAL) { /* use size suggested by the driver, if it knows it */ - alloced = C->fetched_len + 1; + buf = emalloc(C->fetched_len + 1); + memcpy(buf, C->data, C->fetched_len); + buf[C->fetched_len] = 0; + used = C->fetched_len; + } else { + buf = estrndup(C->data, 256); + used = 255; /* not 256; the driver NUL terminated the buffer */ } - - buf = emalloc(alloced); - memcpy(buf, C->data, 256); - used = 255; /* not 256; the driver NUL terminated the buffer */ do { C->fetched_len = 0; Modified: php/php-src/trunk/ext/pdo_odbc/odbc_stmt.c =================================================================== --- php/php-src/trunk/ext/pdo_odbc/odbc_stmt.c 2012-03-14 20:08:14 UTC (rev 324250) +++ php/php-src/trunk/ext/pdo_odbc/odbc_stmt.c 2012-03-14 20:20:33 UTC (rev 324251) @@ -637,12 +637,14 @@ if (C->fetched_len != SQL_NO_TOTAL) { /* use size suggested by the driver, if it knows it */ - alloced = C->fetched_len + 1; + buf = emalloc(C->fetched_len + 1); + memcpy(buf, C->data, C->fetched_len); + buf[C->fetched_len] = 0; + used = C->fetched_len; + } else { + buf = estrndup(C->data, 256); + used = 255; /* not 256; the driver NUL terminated the buffer */ } - - buf = emalloc(alloced); - memcpy(buf, C->data, 256); - used = 255; /* not 256; the driver NUL terminated the buffer */ do { C->fetched_len = 0;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php