GCS_Mavlink: Fix out of bounds access, CID 144337

This commit is contained in:
Michael du Breuil 2017-10-20 11:26:56 -07:00 committed by Francisco Ferreira
parent ee6b43aabf
commit 9b7c3ce9a7

View File

@ -229,7 +229,7 @@ void GCS_MAVLINK::handle_param_request_read(mavlink_message_t *msg)
struct pending_param_request req;
req.chan = chan;
req.param_index = packet.param_index;
memcpy(req.param_name, packet.param_id, sizeof(req.param_name));
memcpy(req.param_name, packet.param_id, MIN(sizeof(packet.param_id), sizeof(req.param_name)));
req.param_name[AP_MAX_NAME_SIZE] = 0;
// queue it for processing by io timer