summaryrefslogtreecommitdiff
path: root/storage/federatedx
diff options
context:
space:
mode:
authorMikhail Chalov <mike.chalov@gmail.com>2022-09-28 07:45:25 -0700
committerGitHub <noreply@github.com>2022-09-28 15:45:25 +0100
commit9de9f105b5cb88249acc39af73d32af337d6fd5f (patch)
tree7f1bf919d86a80e1256ac5f6bbff469ffbbf039f /storage/federatedx
parentb2cfcf1d1f260756cceb4f19e330b4955c381f98 (diff)
downloadmariadb-git-9de9f105b5cb88249acc39af73d32af337d6fd5f.tar.gz
Use memory safe snprintf() in Connect Engine and elsewhere (#2210)
Continue with similar changes as done in 19af1890 to replace sprintf(buf, ...) with snprintf(buf, sizeof(buf), ...), specifically in the "easy" cases where buf is allocated with a size known at compile time. All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc.
Diffstat (limited to 'storage/federatedx')
-rw-r--r--storage/federatedx/ha_federatedx.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc
index ddd6d932724..21c37907ee0 100644
--- a/storage/federatedx/ha_federatedx.cc
+++ b/storage/federatedx/ha_federatedx.cc
@@ -2626,7 +2626,7 @@ int ha_federatedx::index_read_idx_with_result_set(uchar *buf, uint index,
if (io->query(sql_query.ptr(), sql_query.length()))
{
- sprintf(error_buffer, "error: %d '%s'",
+ snprintf(error_buffer, sizeof(error_buffer), "error: %d '%s'",
io->error_code(), io->error_str());
retval= ER_QUERY_ON_FOREIGN_DATA_SOURCE;
goto error;
@@ -3352,7 +3352,7 @@ static int test_connection(MYSQL_THD thd, federatedx_io *io,
if ((retval= io->query(str.ptr(), str.length())))
{
- sprintf(buffer, "database: '%s' username: '%s' hostname: '%s'",
+ snprintf(buffer, sizeof(buffer), "database: '%s' username: '%s' hostname: '%s'",
share->database, share->username, share->hostname);
DBUG_PRINT("info", ("error-code: %d", io->error_code()));
my_error(ER_CANT_CREATE_FEDERATED_TABLE, MYF(0), buffer);