Hi,

I noticed that there are trailing spaces in some cases in the MODE messages
sent by servers when processing an SJOIN message. I saw this happen when
servers join and modes got bursted over.

Here is an example of what I mean (message wrapped in [] to show spaces):

[:test.summercat.com MODE #test +o will   ]

I traced this to ms_sjoin() where there is this format string:

":%s MODE %s %s %s %s %s %s"

The last 3 %s arguments may be blank which leads to these trailing spaces.

It is not exactly a huge problem I know. I only ran into it as I was basing
some parsing code off RFC 2812's grammar. In RFC 1459 this appears possibly
valid, but not in RFC 2812. Perhaps it is still worth making a small update
for though.

I have attached a diff with a possible solution.

Thank you for your time.
--- modules/core/m_join.c	(revision 29442)
+++ modules/core/m_join.c	(working copy)
@@ -812,10 +812,12 @@
 	if(pargs)
 	{
 		sendto_channel_local(ALL_MEMBERS, chptr,
-				     ":%s MODE %s %s %s %s %s %s",
+				     ":%s MODE %s %s %s%s%s%s%s%s%s",
 				     source_p->name, chptr->chname, modebuf,
-				     para[0], CheckEmpty(para[1]), CheckEmpty(para[2]),
-				     CheckEmpty(para[3]));
+				     para[0],
+				     EmptyString(para[1]) ? "" : " ", CheckEmpty(para[1]),
+				     EmptyString(para[2]) ? "" : " ", CheckEmpty(para[2]),
+				     EmptyString(para[3]) ? "" : " ", CheckEmpty(para[3]));
 	}
 
 	if(!joins)
_______________________________________________
ircd-ratbox mailing list
ircd-ratbox@lists.ratbox.org
http://lists.ratbox.org/cgi-bin/mailman/listinfo/ircd-ratbox

Reply via email to