Page 1 of 1

Possible bug in EQStreamFactory::ReaderLoop?

Posted: Wed Mar 03, 2010 8:47 pm
by ginsu
In order to set the lookup for the stream ReaderLoop does this:

sprintf(temp,"%llu.%d",ntohl(from.sin_addr.s_addr),ntohs(from.sin_port));

On Linux this results in a negative port number at times, which causes the resulting string to be 26 characters, overflowing temp and resulting in a buffer overflow crash.

I believe that the format should be:

sprintf(temp,"%u.%hu",ntohl(from.sin_addr.s_addr),ntohs(from.sin_port));

I made this change locally and all seems to work well.

Cheers,
Ginsu