Fix SF bug #2895252 by changing the trailing space to a nul character.
[ircu2.10.12-pk.git] / ircd / m_names.c
index 6c84d5079b8bae2e4655e90c55a67e8fce5f5e91..157b7ee5abc33f7b362cdda3ad722467c183fb3b 100644 (file)
@@ -285,6 +285,7 @@ int m_names(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 
         if (mlen + idx + NICKLEN + 3 > BUFSIZE)     /* space, \r\n\0 */
         {
+          buf[idx-1] = '\0';
           send_reply(sptr, RPL_NAMREPLY, buf);
           strcpy(buf, "* * :");
           idx = 5;
@@ -292,7 +293,10 @@ int m_names(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
         }
       }
       if (flag)
+      {
+        buf[idx-1] = '\0';
         send_reply(sptr, RPL_NAMREPLY, buf);
+      }
       send_reply(sptr, RPL_ENDOFNAMES, "*");
     }
     else if ((chptr = FindChannel(para)) != NULL)