Commit b1056e92 authored by Ilya Lipnitskiy's avatar Ilya Lipnitskiy

protobuf-c-rpc/protobuf-c-rpc.c: perform a more thorough message

check for server closures (responses) to not crash the server in case of
a malformed message (related to #76)
parent fb39c176
......@@ -1054,7 +1054,7 @@ server_connection_response_closure (const ProtobufCMessage *message,
uint8_t buffer_slab[512];
ProtobufCBufferSimple buffer_simple = PROTOBUF_C_BUFFER_SIMPLE_INIT (buffer_slab);
if (message == NULL)
if (!protobuf_c_message_check (message))
{
/* send failed status */
uint32_t header[4];
......@@ -1064,6 +1064,8 @@ server_connection_response_closure (const ProtobufCMessage *message,
header[3] = request->request_id;
protobuf_c_buffer_simple_append (&buffer_simple.base,
16, (uint8_t *) header);
server_failed_literal (server, PROTOBUF_C_ERROR_CODE_BAD_REQUEST,
"response message was malformed, sending failed status to client");
}
else
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment