send( accessing beyond buffer?
I've been working on a game.
One of the things the client-side code has to do is send the name of the player to the server. If I type anything that's more than 3 characters for the name ("Dude" for example), I get error box from Windows saying "Run-Time Check Failure #2 - Stack around the variable 'buf' was corrupted."
I did a little research, and this error only happens when an array is getting accessed outside of it's space.
So my question is, why is send( trying to access beyond 'buf'?
Where 'buf' would contain "S04Dude" and len is 7.
int SockSend(SOCKET *tsock, char* buf, int len)
nError = send(*tsock, buf, len, 0); // Error triggers here; does not stop execution, though
if(nError == SOCKET_ERROR)
printf("SockSend: send( failed: %d\n", WSAGetLastError());