[SDL] SDLNet_TCP_Recv() returns... null socket?

L-28C kixdemp at gmail.com
Sun Sep 9 16:36:12 PDT 2007


Ulrich Eckhardt wrote:
I bet that you have a buffer overrun here. The receive function does
> definitely not modify the value of the first argument passed to it, because 
> it can't. However, you are passing a related pointer (me->Name) to it, and if 
> that buffer is too small, it will happily overwrite anything related there. 
Yes, I contemplated that possibility, but the buffer is 16 bytes... :/

> Also, I wouldn't hard-code the size 16 there, because it means that you have 
> to keep several places where this constant is used in sync. Use a constant 
> with a name, or maybe a macro, or use 'sizeof me->Name'.
I'll do that. ;)

Also don't forget to
> NUL-terminate the string.
> 
> Uli


Any more ideas? This is weird... Thanks!



More information about the SDL mailing list