mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-23 14:17:35 +08:00
uORB devices: Guard more against invalid handles fed to publish routine
This commit is contained in:
committed by
Lorenz Meier
parent
ca59d4cddb
commit
c62c3c98bf
@@ -424,7 +424,13 @@ uORB::DeviceNode::publish(const orb_metadata *meta, orb_advert_t handle, const v
|
||||
uORB::DeviceNode *devnode = (uORB::DeviceNode *)handle;
|
||||
int ret;
|
||||
|
||||
/* this is a bit risky, since we are trusting the handle in order to deref it */
|
||||
/* check if the device handle is initialized */
|
||||
if ((devnode == nullptr) || (meta == nullptr)) {
|
||||
errno = EFAULT;
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* check if the orb meta data matches the publication */
|
||||
if (devnode->_meta != meta) {
|
||||
errno = EINVAL;
|
||||
return ERROR;
|
||||
|
||||
Reference in New Issue
Block a user