summaryrefslogtreecommitdiff
path: root/storage/connect/tabjmg.cpp
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2017-10-16 15:08:17 +0200
committerOlivier Bertrand <bertrandop@gmail.com>2017-10-16 15:08:17 +0200
commitc83e2a63452946cf58241380f03a23ab4884c42b (patch)
treed0bbb84f9a6110ca1346c4ba14003276dca0a728 /storage/connect/tabjmg.cpp
parent6691d12e2d5d0aa26353ddca143067edf4cf56d5 (diff)
downloadmariadb-git-c83e2a63452946cf58241380f03a23ab4884c42b.tar.gz
- Fix a bug in TYPVAL<PSZ> compute causing it sometime not to be executed
This was the cause of the bug in CalculateArray modified: storage/connect/jsonudf.cpp modified: storage/connect/tabjson.cpp modified: storage/connect/value.cpp - Avoid some compiler warnings modified: storage/connect/mongo.cpp modified: storage/connect/tabjmg.cpp modified: storage/connect/tabtbl.cpp modified: storage/connect/tabutil.cpp
Diffstat (limited to 'storage/connect/tabjmg.cpp')
-rw-r--r--storage/connect/tabjmg.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/storage/connect/tabjmg.cpp b/storage/connect/tabjmg.cpp
index 566b1f91611..ba3e1c3e7c0 100644
--- a/storage/connect/tabjmg.cpp
+++ b/storage/connect/tabjmg.cpp
@@ -73,9 +73,10 @@ bool JMGDISC::ColDesc(PGLOBAL g, jobject obj, char *pcn, char *pfmt,
int ncol, int k)
{
const char *key;
- char colname[65];
- char fmt[129];
- bool rc = true;
+ char colname[65];
+ char fmt[129];
+ bool rc = true;
+ size_t z;
jint *n = nullptr;
jstring jkey;
jobject jres;
@@ -105,14 +106,16 @@ bool JMGDISC::ColDesc(PGLOBAL g, jobject obj, char *pcn, char *pfmt,
if (pcn) {
strncpy(colname, pcn, 64);
colname[64] = 0;
- strncat(strncat(colname, "_", 65), key, 65);
+ z = 65 - strlen(colname);
+ strncat(strncat(colname, "_", z), key, z - 1);
} else
strcpy(colname, key);
if (pfmt) {
strncpy(fmt, pfmt, 128);
fmt[128] = 0;
- strncat(strncat(fmt, ".", 129), key, 129);
+ z = 129 - strlen(fmt);
+ strncat(strncat(fmt, ".", z), key, z - 1);
} else
strcpy(fmt, key);