z3950_client: fix string handling for init diagnostics
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 8 Oct 2012 13:45:43 +0000 (15:45 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 8 Oct 2012 13:45:43 +0000 (15:45 +0200)
in the case where addinfo was absent.

src/filter_z3950_client.cpp

index d4f78a9..a42fb61 100644 (file)
@@ -238,9 +238,10 @@ void yf::Z3950Client::Assoc::fixup_init(ODR odr, Z_InitResponse *initrs)
                             odr,
                             (oaddinfo ? strlen(oaddinfo) : 0) + 20 +
                             m_host.length());
+                        *naddinfo = '\0';
                         if (oaddinfo && *oaddinfo)
                         {
-                            strcpy(naddinfo, oaddinfo);
+                            strcat(naddinfo, oaddinfo);
                             strcat(naddinfo, " ");
                         }
                         strcat(naddinfo, "(backend=");