Bounds check mdb_sql_bind_column()

Return -1 if the bounds check fails, otherwise the result of
mdb_bind_column_by_name.

Update other places in the code to check the return value.
This commit is contained in:
Evan Miller
2020-11-08 08:50:17 -05:00
parent 97e1d348f7
commit bbc53dfade
3 changed files with 20 additions and 12 deletions

View File

@@ -1037,11 +1037,8 @@ bind_columns(struct _hstmt *stmt)
if (stmt->rows_affected==0) {
cur = stmt->bind_head;
while (cur) {
if (cur->column_number>0 &&
cur->column_number <= stmt->sql->num_columns) {
mdb_sql_bind_column(stmt->sql, cur->column_number,
cur->varaddr, cur->column_lenbind);
} else {
if (mdb_sql_bind_column(stmt->sql, cur->column_number,
cur->varaddr, cur->column_lenbind) == -1) {
/* log error ? */
}
cur = cur->next;