summaryrefslogtreecommitdiff
path: root/storage/connect/filamfix.cpp
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2023-01-31 10:37:31 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2023-01-31 10:37:31 +0100
commitde2d08994255739d53ba28ea34288ca8352029b1 (patch)
treecc557fe9fa3655a03cae9b6895c6e8a0348b2f86 /storage/connect/filamfix.cpp
parent4d9fe4032b768e04e33482d83199882c7bb0d9d8 (diff)
parent638625278e7cadf42633e6f9d1b663ca1e3e1bb1 (diff)
downloadmariadb-git-de2d08994255739d53ba28ea34288ca8352029b1.tar.gz
Merge branch '10.8' into 10.9
Diffstat (limited to 'storage/connect/filamfix.cpp')
-rw-r--r--storage/connect/filamfix.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/storage/connect/filamfix.cpp b/storage/connect/filamfix.cpp
index 117a4e8dda6..3298a83394c 100644
--- a/storage/connect/filamfix.cpp
+++ b/storage/connect/filamfix.cpp
@@ -36,6 +36,8 @@
#include <fcntl.h>
#endif // !_WIN32
+#include <m_string.h>
+
/***********************************************************************/
/* Include application header files: */
/* global.h is header containing all global declarations. */
@@ -881,7 +883,6 @@ bool BGXFAM::OpenTableFile(PGLOBAL g)
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0,
(LPTSTR)filename, sizeof(filename), NULL);
- strcat(g->Message, filename);
} else
rc = 0;
@@ -1002,7 +1003,7 @@ int BGXFAM::Cardinality(PGLOBAL g)
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0,
(LPTSTR)filename, sizeof(filename), NULL);
- strcat(g->Message, filename);
+ safe_strcat(g->Message, sizeof(g->Message), filename);
return -1;
} else
return 0; // File does not exist
@@ -1382,7 +1383,8 @@ bool BGXFAM::OpenTempFile(PGLOBAL g)
/*********************************************************************/
tempname = (char*)PlugSubAlloc(g, NULL, _MAX_PATH);
PlugSetPath(tempname, To_File, Tdbp->GetPath());
- strcat(PlugRemoveType(tempname, tempname), ".t");
+ PlugRemoveType(tempname, tempname);
+ safe_strcat(tempname, _MAX_PATH, ".t");
remove(tempname); // Be sure it does not exist yet
#if defined(_WIN32)
@@ -1391,11 +1393,12 @@ bool BGXFAM::OpenTempFile(PGLOBAL g)
if (Tfile == INVALID_HANDLE_VALUE) {
DWORD rc = GetLastError();
- snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR), rc, MODE_INSERT, tempname);
+ snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR), rc, MODE_INSERT,
+ tempname);
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0,
(LPTSTR)tempname, _MAX_PATH, NULL);
- strcat(g->Message, tempname);
+ safe_strcat(g->Message, sizeof(g->Message), tempname);
return true;
} // endif Tfile
#else // UNIX
@@ -1403,8 +1406,8 @@ bool BGXFAM::OpenTempFile(PGLOBAL g)
if (Tfile == INVALID_HANDLE_VALUE) {
int rc = errno;
- snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR), rc, MODE_INSERT, tempname);
- strcat(g->Message, strerror(errno));
+ snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR)" %s", rc,
+ MODE_INSERT, tempname, strerror(errno));
return true;
} //endif Tfile
#endif // UNIX