]> granicus.if.org Git - p11-kit/commitdiff
rpc: Avoid calling memcmp() on NULL buffer
authorDaiki Ueno <dueno@redhat.com>
Mon, 29 May 2017 15:15:19 +0000 (17:15 +0200)
committerDaiki Ueno <ueno@gnu.org>
Mon, 29 May 2017 15:28:51 +0000 (17:28 +0200)
Spotted by clang-analyzer.

p11-kit/rpc-message.c

index 32f5a458cacdfcf2f2b08ee7d546ad45ec5a7421..803063f2cd049c6ea7d1c75f84ec696992953634 100644 (file)
@@ -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;
        }