summaryrefslogtreecommitdiff
path: root/storage/connect/plgxml.cpp
diff options
context:
space:
mode:
authorMikhail Chalov <mcchalov@amazon.com>2022-07-19 19:06:55 +0000
committerDaniel Black <daniel@mariadb.org>2022-07-26 16:28:59 +1000
commit19af1890b56c6c147c296479bb6a4ad00fa59dbb (patch)
tree0c2ba4eeaff5dd902a2072a7167bb208ddef4ad1 /storage/connect/plgxml.cpp
parent95eb5e5a12c4b8125b38dfb54366fe4873e21394 (diff)
downloadmariadb-git-19af1890b56c6c147c296479bb6a4ad00fa59dbb.tar.gz
Use memory safe snprintf() in Connect Engine
This commit replaces sprintf(buf, ...) with snprintf(buf, sizeof(buf), ...), specifically in the "easy" cases where buf is allocated with a size known at compile time. The changes make sure we are not write outside array/string bounds which will lead to undefined behaviour. In case the code is trying to write outside bounds - safe version of functions simply cut the string messages so we process this gracefully. 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. bsonudf.cpp warnings cleanup by Daniel Black Reviewer: Daniel Black
Diffstat (limited to 'storage/connect/plgxml.cpp')
-rw-r--r--storage/connect/plgxml.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/storage/connect/plgxml.cpp b/storage/connect/plgxml.cpp
index 8c5cc261899..d78ba120ebc 100644
--- a/storage/connect/plgxml.cpp
+++ b/storage/connect/plgxml.cpp
@@ -52,7 +52,7 @@ bool XMLDOCUMENT::InitZip(PGLOBAL g, PCSZ entry)
zip = new(g) UNZIPUTL(entry, NULL, mul);
return zip == NULL;
#else // !ZIP_SUPPORT
- sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP");
+ snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "ZIP");
return true;
#endif // !ZIP_SUPPORT
} // end of InitZip