migration/rdma: Safely convert control types
commit482a33c53cbc9d2b0c47d4df03b659bf50258c21
authorDr. David Alan Gilbert <dgilbert@redhat.com>
Mon, 17 Jul 2017 11:09:35 +0000 (17 12:09 +0100)
committerJuan Quintela <quintela@redhat.com>
Tue, 18 Jul 2017 15:36:17 +0000 (18 17:36 +0200)
tree8eeb6139da43e864bb52e4010e980567d4773444
parent9c98cfbe72b21d9d84b9ea8d231bde103b9fb7ae
migration/rdma: Safely convert control types

control_desc[] is an array of strings that correspond to a
series of message types; they're used only for error messages, but if
the message type is seriously broken then we could go off the end of
the array.

Convert the array to a function control_desc() that bound checks.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Message-Id: <20170717110936.23314-6-dgilbert@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
migration/rdma.c