PATCH-P0-FIX-UPSTREAM: Fix possible buffer overflow

Maintainer: Michal Hrusecky <Michal.Hrusecky@opensuse.org>

Index: storage/connect/tabxml.cpp
===================================================================
--- storage/connect/tabxml.cpp.orig
+++ storage/connect/tabxml.cpp
@@ -223,22 +223,22 @@ PQRYRES XMLColumns(PGLOBAL g, char *dp,
      more:
       if (vp->atp) {
         strncpy(colname, vp->atp->GetName(g), sizeof(colname));
-        strncat(xcol->Name, colname, 64);
+        strncat(xcol->Name, colname, 64 - strlen(xcol->Name) -1);
         vp->atp->GetText(g, buf, sizeof(buf));
         strncat(fmt, "@", sizeof(fmt));
 
         if (j)
-          strncat(fmt, colname, sizeof(fmt));
+          strncat(fmt, colname, sizeof(fmt) - strlen(fmt) - 1);
 
       } else {
         if (tdp->Usedom && node->GetType() != 1)
           continue;
 
         strncpy(colname, node->GetName(g), sizeof(colname));
-        strncat(xcol->Name, colname, 64);
+        strncat(xcol->Name, colname, 64 - strlen(xcol->Name) -1);
 
         if (j)
-          strncat(fmt, colname, sizeof(fmt));
+          strncat(fmt, colname, sizeof(fmt) - strlen(fmt) - 1);
 
         if (j < lvl && ok) {
           vp = lvlp[j+1];
