added json format validation to read_socket_raw
This commit is contained in:
parent
3fc339a9fb
commit
8bd3df1ae1
@ -188,7 +188,20 @@ char *read_socket_raw(int socket)
|
|||||||
|
|
||||||
return_section:
|
return_section:
|
||||||
|
|
||||||
content_buffer[content_size] = '\0';
|
content_buffer[content_size] = '\0'; //NULL TERM
|
||||||
|
|
||||||
|
//VALIDATE JSON FORMAT
|
||||||
|
struct json_object *json = json_tokener_parse(content_buffer);
|
||||||
|
if (json == NULL)
|
||||||
|
{
|
||||||
|
//RESET content_buffer
|
||||||
|
why2_deallocate(content_buffer);
|
||||||
|
content_buffer = NULL;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
//DEALLOCATION
|
||||||
|
json_object_put(json);
|
||||||
|
}
|
||||||
|
|
||||||
return content_buffer;
|
return content_buffer;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user