evas cserver client tool - handle possible < 0 sized return

this is cserver so its trusted but handle possible < 0 size msg.
address coverity CID1361243
This commit is contained in:
Carsten Haitzler 2016-08-06 16:16:19 +09:00
parent 2bcb4105e1
commit b26bef48f2
1 changed files with 5 additions and 0 deletions

View File

@ -435,6 +435,11 @@ int main(void)
if ((t=recv(s, &size, sizeof(size), MSG_DONTWAIT)) > 0)
{
if (size < 0)
{
printf("got a message claiming < 0 size payload!\n");
continue;
}
len = recv(s, msgbuf, size, 0);
printf("size of received message: %d\n", len);
if (len != size)