summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2015-11-08 14:56:48 +0100
committerOlivier Bertrand <bertrandop@gmail.com>2015-11-08 14:56:48 +0100
commitad916ef33c1e779da6940cce0f6e64b1b380bd6d (patch)
tree73ff90fc341735e148bc11a99a13e2483afeb6e1
parente7fa7e085843788e1fb565842bcb9a84e6b9d156 (diff)
parent0a852591dbaee4c33ab87d92d70a56cab225a2ca (diff)
downloadmariadb-git-ad916ef33c1e779da6940cce0f6e64b1b380bd6d.tar.gz
Merge branch 'ob-10.1' into 10.1
-rw-r--r--storage/connect/tabxml.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/storage/connect/tabxml.cpp b/storage/connect/tabxml.cpp
index 49fa9a1c554..9c47829d5bc 100644
--- a/storage/connect/tabxml.cpp
+++ b/storage/connect/tabxml.cpp
@@ -60,6 +60,7 @@ extern "C" char version[];
#endif // !__WIN__
#define TYPE_UNKNOWN 12 /* Must be greater than other types */
+#define XSTR(M) sizeof(M) - strlen(M) - 1 /* To avoid overflow*/
/***********************************************************************/
/* Class and structure used by XMLColumns. */
@@ -225,30 +226,30 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)
more:
if (vp->atp) {
strncpy(colname, vp->atp->GetName(g), sizeof(colname));
- strncat(xcol->Name, colname, 64);
+ strncat(xcol->Name, colname, XSTR(xcol->Name));
switch (vp->atp->GetText(g, buf, sizeof(buf))) {
case RC_INFO:
PushWarning(g, txmp);
case RC_OK:
- strncat(fmt, "@", sizeof(fmt));
+ strncat(fmt, "@", XSTR(fmt));
break;
default:
goto err;
} // enswitch rc
if (j)
- strncat(fmt, colname, sizeof(fmt));
+ strncat(fmt, colname, XSTR(fmt));
} else {
if (tdp->Usedom && node->GetType() != 1)
continue;
strncpy(colname, node->GetName(g), sizeof(colname));
- strncat(xcol->Name, colname, 64);
+ strncat(xcol->Name, colname, XSTR(xcol->Name));
if (j)
- strncat(fmt, colname, sizeof(fmt));
+ strncat(fmt, colname, XSTR(fmt));
if (j < lvl && ok) {
vp = lvlp[j+1];
@@ -266,9 +267,10 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)
if (!vp->atp)
node = vp->nl->GetItem(g, vp->k++, node);
- strncat(strncat(fmt, colname, 125), "/", 125);
- strncat(xcol->Name, "_", 64);
- j++;
+ strncat(fmt, colname, XSTR(fmt));
+ strncat(fmt, "/", XSTR(fmt));
+ strncat(xcol->Name, "_", XSTR(xcol->Name));
+ j++;
vp->n = (int)strlen(xcol->Name);
vp->m = (int)strlen(fmt);
goto more;