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

add a couple more safeguards in ReceiveXX routines
parent ab40a6b9
No related branches found
No related tags found
No related merge requests found
......@@ -240,9 +240,13 @@ class GmshServer {
}
int ReceiveMessageHeader(int *type, int *len)
{
_ReceiveData(type, sizeof(int));
if(_ReceiveData(len, sizeof(int)))
if(_ReceiveData(type, sizeof(int))){
if(*type < 0) return 0;
if(_ReceiveData(len, sizeof(int))){
if(*len < 0) return 0;
return 1;
}
}
return 0;
}
int ReceiveMessageBody(int len, char *str)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment