File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 22
22
PDO_API void pdo_handle_error (pdo_dbh_t * dbh , pdo_stmt_t * stmt );
23
23
24
24
#define PDO_DBH_CLEAR_ERR () do { \
25
- strlcpy(dbh->error_code, PDO_ERR_NONE, sizeof(PDO_ERR_NONE)); \
25
+ ZEND_ASSERT(sizeof(dbh->error_code) == sizeof(PDO_ERR_NONE)); \
26
+ memcpy(dbh->error_code, PDO_ERR_NONE, sizeof(PDO_ERR_NONE)); \
26
27
if (dbh->query_stmt) { \
27
28
dbh->query_stmt = NULL; \
28
29
zval_ptr_dtor(&dbh->query_stmt_zval); \
29
30
} \
30
31
} while (0)
31
- #define PDO_STMT_CLEAR_ERR () strcpy(stmt->error_code, PDO_ERR_NONE)
32
+ #define PDO_STMT_CLEAR_ERR () do { \
33
+ ZEND_ASSERT(sizeof(stmt->error_code) == sizeof(PDO_ERR_NONE)); \
34
+ memcpy(stmt->error_code, PDO_ERR_NONE, sizeof(PDO_ERR_NONE)); \
35
+ } while (0)
32
36
#define PDO_HANDLE_DBH_ERR () if (strcmp(dbh->error_code, PDO_ERR_NONE)) { pdo_handle_error(dbh, NULL); }
33
37
#define PDO_HANDLE_STMT_ERR () if (strcmp(stmt->error_code, PDO_ERR_NONE)) { pdo_handle_error(stmt->dbh, stmt); }
34
38
You can’t perform that action at this time.
0 commit comments