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

Alan Wolfe Atrix2 at cox.net
Mon Sep 10 23:26:12 PDT 2007


Any multithreading going on? Tossin it out there just in case...

-----Original Message-----
From: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of L-28C
Sent: Sunday, September 09, 2007 4:36 PM
To: sdl at libsdl.org
Subject: Re: [SDL] SDLNet_TCP_Recv() returns... null socket?

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!

_______________________________________________
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org



More information about the SDL mailing list