summaryrefslogtreecommitdiffstats
path: root/src/lib/mysql
diff options
context:
space:
mode:
authorMarcin Siodelski <marcin@isc.org>2019-08-22 10:29:27 +0200
committerMarcin Siodelski <marcin@isc.org>2019-08-22 10:29:27 +0200
commit10fe55ce89e9e6c6f6458f671bd6787b5f570a07 (patch)
treedb0c1664590906898840efe73d6e84ef9e9d19a0 /src/lib/mysql
parent[#851,!24-p] Avoid referencing out of bounds element of binding array. (diff)
downloadkea-10fe55ce89e9e6c6f6458f671bd6787b5f570a07.tar.xz
kea-10fe55ce89e9e6c6f6458f671bd6787b5f570a07.zip
[#851,!24-p] Avoid referencing out of bounds vector element in MySQL conn.
Diffstat (limited to 'src/lib/mysql')
-rw-r--r--src/lib/mysql/mysql_connection.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/mysql/mysql_connection.h b/src/lib/mysql/mysql_connection.h
index 750bd59549..929fbc16e5 100644
--- a/src/lib/mysql/mysql_connection.h
+++ b/src/lib/mysql/mysql_connection.h
@@ -359,7 +359,8 @@ public:
int status = 0;
if (!in_bind_vec.empty()) {
// Bind parameters to the prepared statement.
- status = mysql_stmt_bind_param(statements_[index], &in_bind_vec[0]);
+ status = mysql_stmt_bind_param(statements_[index],
+ in_bind_vec.empty() ? 0 : &in_bind_vec[0]);
checkError(status, index, "unable to bind parameters for select");
}
@@ -432,7 +433,8 @@ public:
}
// Bind the parameters to the statement
- int status = mysql_stmt_bind_param(statements_[index], &in_bind_vec[0]);
+ int status = mysql_stmt_bind_param(statements_[index],
+ in_bind_vec.empty() ? 0 : &in_bind_vec[0]);
checkError(status, index, "unable to bind parameters");
// Execute the statement
@@ -474,7 +476,8 @@ public:
}
// Bind the parameters to the statement
- int status = mysql_stmt_bind_param(statements_[index], &in_bind_vec[0]);
+ int status = mysql_stmt_bind_param(statements_[index],
+ in_bind_vec.empty() ? 0 : &in_bind_vec[0]);
checkError(status, index, "unable to bind parameters");
// Execute the statement