summaryrefslogtreecommitdiff
path: root/p11-kit/rpc-message.c
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@redhat.com>2017-05-22 15:44:50 +0200
committerDaiki Ueno <ueno@gnu.org>2017-05-22 15:57:52 +0200
commit480337a68446033dc9374e9c4fe4d3cae9d4e972 (patch)
tree0ddab0483ee2c899eaeaa7e22d521e8322afc3e6 /p11-kit/rpc-message.c
parent8b64577c3bb4d5dd60e4939223550f2f2002284b (diff)
rpc: Return early if call_id of request is ERROR
Otherwise it will cause assertion failure in a few lines below. Spotted by amrican fuzzy lop.
Diffstat (limited to 'p11-kit/rpc-message.c')
-rw-r--r--p11-kit/rpc-message.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/p11-kit/rpc-message.c b/p11-kit/rpc-message.c
index b5ac528..d1b491d 100644
--- a/p11-kit/rpc-message.c
+++ b/p11-kit/rpc-message.c
@@ -171,7 +171,8 @@ p11_rpc_message_parse (p11_rpc_message *msg,
msg->signature = msg->sigverify = NULL;
/* The call id and signature */
- if (call_id >= P11_RPC_CALL_MAX) {
+ if (call_id >= P11_RPC_CALL_MAX ||
+ (type == P11_RPC_REQUEST && call_id == P11_RPC_CALL_ERROR)) {
p11_message ("invalid message: bad call id: %d", call_id);
return false;
}