mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fix illogical strncpy size
While both source and destination buffers have the same size (6 bytes), and this is unlikely to change in the future, we nonetheless fix the illogical `strncpy` size. Based on a pull request provided by Cristian Rodríguez.
This commit is contained in:
parent
ea1ea33bd5
commit
12410df5fb
1 changed files with 7 additions and 7 deletions
|
@ -45,33 +45,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 */
|
||||
strncpy(*pdo_err, PDO_ERR_NONE, sizeof(PDO_ERR_NONE));
|
||||
strncpy(*pdo_err, PDO_ERR_NONE, sizeof(*pdo_err));
|
||||
return 0;
|
||||
}
|
||||
switch (einfo->errcode) {
|
||||
case SQLITE_NOTFOUND:
|
||||
strncpy(*pdo_err, "42S02", sizeof("42S02"));
|
||||
strncpy(*pdo_err, "42S02", sizeof(*pdo_err));
|
||||
break;
|
||||
|
||||
case SQLITE_INTERRUPT:
|
||||
strncpy(*pdo_err, "01002", sizeof("01002"));
|
||||
strncpy(*pdo_err, "01002", sizeof(*pdo_err));
|
||||
break;
|
||||
|
||||
case SQLITE_NOLFS:
|
||||
strncpy(*pdo_err, "HYC00", sizeof("HYC00"));
|
||||
strncpy(*pdo_err, "HYC00", sizeof(*pdo_err));
|
||||
break;
|
||||
|
||||
case SQLITE_TOOBIG:
|
||||
strncpy(*pdo_err, "22001", sizeof("22001"));
|
||||
strncpy(*pdo_err, "22001", sizeof(*pdo_err));
|
||||
break;
|
||||
|
||||
case SQLITE_CONSTRAINT:
|
||||
strncpy(*pdo_err, "23000", sizeof("23000"));
|
||||
strncpy(*pdo_err, "23000", sizeof(*pdo_err));
|
||||
break;
|
||||
|
||||
case SQLITE_ERROR:
|
||||
default:
|
||||
strncpy(*pdo_err, "HY000", sizeof("HY000"));
|
||||
strncpy(*pdo_err, "HY000", sizeof(*pdo_err));
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue