added empty content check to read_socket
This commit is contained in:
parent
72305929b2
commit
3a4f5ed7b6
@ -79,6 +79,12 @@ char *read_socket(int socket)
|
|||||||
//COUNT content_size
|
//COUNT content_size
|
||||||
ioctl(socket, FIONREAD, &content_size);
|
ioctl(socket, FIONREAD, &content_size);
|
||||||
|
|
||||||
|
if (content_size == 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Reading socket failed.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
//ALLOCATE
|
//ALLOCATE
|
||||||
content = why2_calloc(content_size + 1, sizeof(char));
|
content = why2_calloc(content_size + 1, sizeof(char));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user