patch-ircd_channel_c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. $OpenBSD: patch-ircd_channel_c,v 1.1 2003/11/11 15:17:34 margarida Exp $
  2. --- ircd/channel.c.orig 2000-06-06 23:34:27.000000000 +0100
  3. +++ ircd/channel.c 2003-11-09 00:03:46.000000000 +0000
  4. @@ -1966,7 +1966,7 @@ char *parv[];
  5. Reg Link *lp;
  6. Reg aChannel *chptr;
  7. Reg char *name, *key = NULL;
  8. - int i, flags = 0;
  9. + int i, tmplen, flags = 0;
  10. char *p = NULL, *p2 = NULL, *s, chop[5];
  11. if (parc < 2 || *parv[1] == '\0')
  12. @@ -2115,10 +2115,20 @@ char *parv[];
  13. parv[0]), name);
  14. continue;
  15. }
  16. + tmplen = strlen(name);
  17. + if (i + tmplen + 2 /* comma and \0 */
  18. + >= sizeof(jbuf) )
  19. + {
  20. +
  21. + break;
  22. +
  23. + }
  24. if (*jbuf)
  25. - (void)strcat(jbuf, ",");
  26. - (void)strncat(jbuf, name, sizeof(jbuf) - i - 1);
  27. - i += strlen(name)+1;
  28. + {
  29. + jbuf[i++] = ',';
  30. + }
  31. + (void)strcpy(jbuf + i, name);
  32. + i += tmplen;
  33. }
  34. p = NULL;
  35. @@ -2270,6 +2280,16 @@ char *parv[];
  36. parv[0], name, chop);
  37. else if (*chptr->chname != '&')
  38. {
  39. + /* ":" (1) "nick" (NICKLEN) " JOIN :" (7), comma (1)
  40. + ** possible chop (4), ending \r\n\0 (3) = 16
  41. + ** must fit in the cbuf as well! --B. */
  42. + if (strlen(cbuf) + strlen(name) + NICKLEN + 16
  43. + >= sizeof(cbuf))
  44. + {
  45. + sendto_serv_butone(cptr, ":%s JOIN :%s",
  46. + parv[0], cbuf);
  47. + cbuf[0] = '\0';
  48. + }
  49. if (*cbuf)
  50. strcat(cbuf, ",");
  51. strcat(cbuf, name);