diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2011-08-07 23:46:00 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2011-08-07 23:46:00 +0000 |
commit | 34f08a371539fa8103a9872616c1281de33ba1f8 (patch) | |
tree | 427abb27ca9ca62e3080876e249765f7542486a6 | |
parent | 04b575f409eb305c12df4e447bed4c147d7237f1 (diff) | |
download | php-git-34f08a371539fa8103a9872616c1281de33ba1f8.tar.gz |
Fixes for variety of issues identified by coverity scan
-rwxr-xr-x | ext/pdo/pdo.c | 2 | ||||
-rwxr-xr-x | ext/pdo/pdo_dbh.c | 2 | ||||
-rw-r--r-- | ext/pdo/pdo_sql_parser.re | 5 | ||||
-rwxr-xr-x | ext/pdo/php_pdo_int.h | 2 |
4 files changed, 6 insertions, 5 deletions
diff --git a/ext/pdo/pdo.c b/ext/pdo/pdo.c index 169ce32e25..b654fea639 100755 --- a/ext/pdo/pdo.c +++ b/ext/pdo/pdo.c @@ -191,7 +191,7 @@ PDO_API int php_pdo_register_driver(pdo_driver_t *driver) } return zend_hash_add(&pdo_driver_hash, (char*)driver->driver_name, driver->driver_name_len, - (void**)&driver, sizeof(driver), NULL); + (void**)&driver, sizeof(pdo_driver_t *), NULL); } PDO_API void php_pdo_unregister_driver(pdo_driver_t *driver) diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index b444f14fb3..30d1fb4dbc 100755 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -57,7 +57,7 @@ void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *sqlstate pdo_err = &stmt->error_code; } - strcpy(*pdo_err, sqlstate); + strncpy(*pdo_err, sqlstate, 6); /* hash sqlstate to error messages */ msg = pdo_sqlstate_state_to_description(*pdo_err); diff --git a/ext/pdo/pdo_sql_parser.re b/ext/pdo/pdo_sql_parser.re index bb7af3575d..92411f8075 100644 --- a/ext/pdo/pdo_sql_parser.re +++ b/ext/pdo/pdo_sql_parser.re @@ -236,6 +236,9 @@ safe: plc->freeq = 0; break; + case IS_BOOL: + convert_to_long(param->parameter); + case IS_LONG: case IS_DOUBLE: convert_to_string(param->parameter); @@ -244,8 +247,6 @@ safe: plc->freeq = 0; break; - case IS_BOOL: - convert_to_long(param->parameter); default: convert_to_string(param->parameter); if (!stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter), diff --git a/ext/pdo/php_pdo_int.h b/ext/pdo/php_pdo_int.h index 774cd76f14..62b3bb9188 100755 --- a/ext/pdo/php_pdo_int.h +++ b/ext/pdo/php_pdo_int.h @@ -58,7 +58,7 @@ extern pdo_driver_t *pdo_find_driver(const char *name, int namelen); extern void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt TSRMLS_DC); #define PDO_DBH_CLEAR_ERR() do { \ - strlcpy(dbh->error_code, PDO_ERR_NONE, sizeof(PDO_ERR_NONE)); \ + strncpy(dbh->error_code, PDO_ERR_NONE, sizeof(PDO_ERR_NONE)); \ if (dbh->query_stmt) { \ dbh->query_stmt = NULL; \ zend_objects_store_del_ref(&dbh->query_stmt_zval TSRMLS_CC); \ |