Skip to content
Snippets Groups Projects
Commit 95412237 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

don't test size/length < 0

parent c6bf9de7
No related branches found
No related tags found
No related merge requests found
...@@ -205,7 +205,6 @@ class GmshSocket{ ...@@ -205,7 +205,6 @@ class GmshSocket{
{ {
*swap = 0; *swap = 0;
if(_ReceiveData(type, sizeof(int)) > 0){ if(_ReceiveData(type, sizeof(int)) > 0){
if(*type < 0) return 0;
if(*type > 65535){ if(*type > 65535){
// the data comes from a machine with different endianness and // the data comes from a machine with different endianness and
// we must swap the bytes // we must swap the bytes
...@@ -213,7 +212,6 @@ class GmshSocket{ ...@@ -213,7 +212,6 @@ class GmshSocket{
_SwapBytes((char*)type, sizeof(int), 1); _SwapBytes((char*)type, sizeof(int), 1);
} }
if(_ReceiveData(len, sizeof(int)) > 0){ if(_ReceiveData(len, sizeof(int)) > 0){
if(*len < 0) return 0;
if(*swap) _SwapBytes((char*)len, sizeof(int), 1); if(*swap) _SwapBytes((char*)len, sizeof(int), 1);
return 1; return 1;
} }
...@@ -372,7 +370,7 @@ class GmshServer : public GmshSocket{ ...@@ -372,7 +370,7 @@ class GmshServer : public GmshSocket{
#if !defined(WIN32) || defined(__CYGWIN__) #if !defined(WIN32) || defined(__CYGWIN__)
if(tmpsock < 0) if(tmpsock < 0)
#else #else
if(tmpsock == (int)INVALID_SOCKET) if(tmpsock == (int)INVALID_SOCKET)
#endif #endif
throw "Couldn't create socket"; throw "Couldn't create socket";
// bind the socket to its name // bind the socket to its name
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment