[dcc2] Reducing the size of the DCC2 negotiation message

Hydra hydra at hydrairc.com
Mon May 10 19:39:13 EDT 2004


 
> > If it was me creating tokens, I would create ALL token 
> names and ALL 
> > text based token parameters as 4 bytes long.

> In my mind, this is just asking for more exploits. You need 
> to correctly handle the instances where a malicious user 
> specifies < 4 bytes, > 4 bytes, etc. And if you don't, well 
> it's real easy to crash someones IRC client.
> I would say, stay away from such hacks. Not to mention, even 
> in C this gains almost no speed. The strcmp functions are 
> often written in optimized assembler code. They make sure to 
> take advantage of the CPUs features such as multiple pipes. 
> Therefore, it's possible that doing as you suggested could in 
> fact make it slower! Unlikely, but possible.

If it was slow, then Mr Carmack wouldn't have used the same technique in the
Doom and Quake source code ;)

It's not a hack, it's an efficient way of doing things.  I do agree that
it's code that doesn't really need to be optimized that much, it's hardly as
if DCC2 token matching functions are going to be called hundreds of times a
second in an IRC client that ould make any difference.

Regardless of how a client implements its token checking I think that token
names should definitely be limited to 4 characters.

Hydra



More information about the dcc2 mailing list