Extra spaces stripped
Granted much has changed since the old days but back when it was put in it was to deal with a way to crash services
Anope Version 1.5.13
--------------------
Provided by Anope Dev. <
dev@anope.org>
2004/01/30 Fixed malformed buffer bug (0000398)
Okay how this affected anope
1. Commands take in account the buffer is formed like this for all commands, buffer containing what command, params etc...
sender PRIVMSG target COMMAND buffer
2. If one was to craft a message that sent an extra space after command like so (I put <space> to show it better)
sender PRIVMSG target COMMAND<space><space>buffer
3. Without stripping anope would look at it and go
- COMMAND - lets say TOPIC
- Well TOPIC needs two params the channel and topic, split at <space>
- Okay channel name is <space> or NULL
- Topic is the rest
4. At this point many of the commands never bothered to check if the params were NULL, so what to do, the huge fix of fixing each command to NULL check to avoid crash or strip extra white space. The simple was to strip white and get back to the rest
Over time many of the commands were fixed up to prevent such a problem. However the stripping remained.
The fixes are
1. Make all commands that accept user input be NULL checked to avoid this
2. Keep stripping white space
3. Make the commands not reply in strtok() and take commands as char arrays
Just my two cents..