mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-25 16:56:25 +08:00
fix for segv if topic has not been published
If the topic has not been published, orb_copy returns a negative number which causes update() to memset the data contents to zero. In some instances data is a null pointer. This causes a segment violation crash. Added a check for data != 0 Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
@@ -86,8 +86,10 @@ MavlinkOrbSubscription::update(uint64_t *time, void* data)
|
||||
}
|
||||
|
||||
if (orb_copy(_topic, _fd, data)) {
|
||||
/* error copying topic data */
|
||||
memset(data, 0, _topic->o_size);
|
||||
if (data) {
|
||||
/* error copying topic data */
|
||||
memset(data, 0, _topic->o_size);
|
||||
}
|
||||
return false;
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user