diff options
Diffstat (limited to 'storage/connect/json.cpp')
-rw-r--r-- | storage/connect/json.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/storage/connect/json.cpp b/storage/connect/json.cpp index 4078a03830a..a46d6001434 100644 --- a/storage/connect/json.cpp +++ b/storage/connect/json.cpp @@ -10,6 +10,7 @@ /* Include relevant sections of the MariaDB header file. */ /***********************************************************************/ #include <my_global.h> +#include <m_string.h> /***********************************************************************/ /* Include application header files: */ @@ -270,7 +271,7 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, char* fn, int pretty) { jdp->dfp = GetDefaultPrec(); if (!jsp) { - strcpy(g->Message, "Null json tree"); + safe_strcpy(g->Message, sizeof(g->Message), "Null json tree"); throw 1; } else if (!fn) { // Serialize to a string @@ -278,9 +279,8 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, char* fn, int pretty) { b = pretty == 1; } else { if (!(fs = fopen(fn, "wb"))) { - snprintf(g->Message, sizeof(g->Message), MSG(OPEN_MODE_ERROR), - "w", (int)errno, fn); - strcat(strcat(g->Message, ": "), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_MODE_ERROR) ": %s", + "w", (int)errno, fn, strerror(errno)); throw 2; } else if (pretty >= 2) { // Serialize to a pretty file |