summaryrefslogtreecommitdiff
path: root/p11-kit
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@redhat.com>2017-05-29 17:15:19 +0200
committerDaiki Ueno <ueno@gnu.org>2017-05-29 17:28:51 +0200
commita2a2108fce9a5cebaee17f29bda8d9edf6a0fbc8 (patch)
tree1b00a8418d6f1323287bf9bde6763a4dba403558 /p11-kit
parent3e65d8a23b1f0e1a4d132cf04fdbc9d588cbe02f (diff)
rpc: Avoid calling memcmp() on NULL buffer
Spotted by clang-analyzer.
Diffstat (limited to 'p11-kit')
-rw-r--r--p11-kit/rpc-message.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/p11-kit/rpc-message.c b/p11-kit/rpc-message.c
index 32f5a45..803063f 100644
--- a/p11-kit/rpc-message.c
+++ b/p11-kit/rpc-message.c
@@ -191,7 +191,9 @@ p11_rpc_message_parse (p11_rpc_message *msg,
msg->sigverify = msg->signature;
/* Verify the incoming signature */
- if (!p11_rpc_buffer_get_byte_array (msg->input, &msg->parsed, &val, &len)) {
+ if (!p11_rpc_buffer_get_byte_array (msg->input, &msg->parsed, &val, &len) ||
+ /* This can happen if the length header == 0xffffffff */
+ val == NULL) {
p11_message ("invalid message: couldn't read signature");
return false;
}