From 2df326c6f5b5313348e771520299d90883a71054 Mon Sep 17 00:00:00 2001 From: Monty Date: Sun, 13 Jun 2021 19:46:16 +0300 Subject: Fixed compiler warnings - Usage of strncpy that didn't set an end \0 - Initialized some variables that caused compiler warnings - Increased buffer that caused warnings from strncpy One warning from InnoDB, others from Connect. --- storage/connect/jsonudf.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'storage/connect/jsonudf.cpp') diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp index c633993863c..73ab4a8dfde 100644 --- a/storage/connect/jsonudf.cpp +++ b/storage/connect/jsonudf.cpp @@ -4758,7 +4758,7 @@ char *jbin_array(UDF_INIT *initid, UDF_ARGS *args, char *result, bsp = NULL; if (!bsp && (bsp = JbinAlloc(g, args, initid->max_length, NULL))) - strncpy(bsp->Msg, g->Message, BMX); + *strncpy(bsp->Msg, g->Message, BMX-1)= 0; // Keep result of constant function g->Xchk = (initid->const_item) ? bsp : NULL; @@ -4829,7 +4829,7 @@ char *jbin_array_add_values(UDF_INIT *initid, UDF_ARGS *args, char *result, } else if ((bsp = JbinAlloc(g, args, initid->max_length, NULL))) - strncpy(bsp->Msg, g->Message, BMX); + *strncpy(bsp->Msg, g->Message, BMX-1)= 0; // Keep result of constant function g->Xchk = (initid->const_item) ? bsp : NULL; @@ -5051,7 +5051,7 @@ char *jbin_object(UDF_INIT *initid, UDF_ARGS *args, char *result, } else if ((bsp = JbinAlloc(g, args, initid->max_length, NULL))) - strncpy(bsp->Msg, g->Message, BMX); + *strncpy(bsp->Msg, g->Message, BMX-1)= 0; // Keep result of constant function g->Xchk = (initid->const_item) ? bsp : NULL; @@ -5107,7 +5107,7 @@ char *jbin_object_nonull(UDF_INIT *initid, UDF_ARGS *args, char *result, } else if ((bsp = JbinAlloc(g, args, initid->max_length, NULL))) - strncpy(bsp->Msg, g->Message, BMX); + *strncpy(bsp->Msg, g->Message, BMX-1)= 0; // Keep result of constant function g->Xchk = (initid->const_item) ? bsp : NULL; @@ -5166,7 +5166,7 @@ char *jbin_object_key(UDF_INIT *initid, UDF_ARGS *args, char *result, } else if ((bsp = JbinAlloc(g, args, initid->max_length, NULL))) - strncpy(bsp->Msg, g->Message, BMX); + *strncpy(bsp->Msg, g->Message, BMX-1)= 0; // Keep result of constant function g->Xchk = (initid->const_item) ? bsp : NULL; -- cgit v1.2.1