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)
This commit is contained in:
Ilya Lipnitskiy 2013-11-27 15:21:40 -08:00
parent fb39c17616
commit b1056e922a

View File

@ -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
{