diff options
-rw-r--r-- | ext/pdo/pdo_sql_parser.re | 4 | ||||
-rw-r--r-- | ext/pdo_sqlite/sqlite_driver.c | 14 |
2 files changed, 9 insertions, 9 deletions
diff --git a/ext/pdo/pdo_sql_parser.re b/ext/pdo/pdo_sql_parser.re index 92411f8075..a2a22e7517 100644 --- a/ext/pdo/pdo_sql_parser.re +++ b/ext/pdo/pdo_sql_parser.re @@ -213,7 +213,7 @@ safe: param->param_type TSRMLS_CC)) { /* bork */ ret = -1; - strcpy(stmt->error_code, stmt->dbh->error_code); + strncpy(stmt->error_code, stmt->dbh->error_code, 6); if (buf) { efree(buf); } @@ -254,7 +254,7 @@ safe: param->param_type TSRMLS_CC)) { /* bork */ ret = -1; - strcpy(stmt->error_code, stmt->dbh->error_code); + strncpy(stmt->error_code, stmt->dbh->error_code, 6); goto clean_up; } plc->freeq = 1; diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c index ee50f5daa7..a33d3ca487 100644 --- a/ext/pdo_sqlite/sqlite_driver.c +++ b/ext/pdo_sqlite/sqlite_driver.c @@ -47,33 +47,33 @@ int _pdo_sqlite_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int li } einfo->errmsg = pestrdup((char*)sqlite3_errmsg(H->db), dbh->is_persistent); } else { /* no error */ - strcpy(*pdo_err, PDO_ERR_NONE); + strncpy(*pdo_err, PDO_ERR_NONE, sizeof(PDO_ERR_NONE)); return 0; } switch (einfo->errcode) { case SQLITE_NOTFOUND: - strcpy(*pdo_err, "42S02"); + strncpy(*pdo_err, "42S02", sizeof("42S02")); break; case SQLITE_INTERRUPT: - strcpy(*pdo_err, "01002"); + strncpy(*pdo_err, "01002", sizeof("01002")); break; case SQLITE_NOLFS: - strcpy(*pdo_err, "HYC00"); + strncpy(*pdo_err, "HYC00", sizeof("HYC00")); break; case SQLITE_TOOBIG: - strcpy(*pdo_err, "22001"); + strncpy(*pdo_err, "22001", sizeof("22001")); break; case SQLITE_CONSTRAINT: - strcpy(*pdo_err, "23000"); + strncpy(*pdo_err, "23000", sizeof("23000")); break; case SQLITE_ERROR: default: - strcpy(*pdo_err, "HY000"); + strncpy(*pdo_err, "HY000", sizeof("HY000")); break; } |