Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugins: ftp: fix null pointer dereference #1833

Merged
merged 1 commit into from
Feb 22, 2023
Merged

plugins: ftp: fix null pointer dereference #1833

merged 1 commit into from
Feb 22, 2023

Conversation

lopsided98
Copy link
Contributor

df4e529 mistakenly switched PayloadHeader::data from using a non-standards compliant (but accepted by most compilers) flexible array to a pointer. This resulted in an attempt to dereference the uninitialized contents of the array.

This patch eliminates PayloadHeader::data and instead makes FTPRequest::data() use pointer arithmetic to get the data buffer from within the payload buffer.

This fixes the crash, but the plugin still doesn't work quite right, at least with ArduPilot. The only command I have been able to execute successfully is checksum.

Fixes #1695

df4e529 mistakenly switched PayloadHeader::data from using a non-standards
compliant (but accepted by most compilers) flexible array to a pointer. This
resulted in an attempt to dereference the uninitialized contents of the array.

This patch eliminates PayloadHeader::data and instead makes FTPRequest::data()
use pointer arithmetic to get the data buffer from within the payload buffer.
Copy link
Member

@vooon vooon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks!

@vooon vooon added this to TODO in ROS2 support via automation Feb 22, 2023
@vooon vooon added this to the Version 2.5 milestone Feb 22, 2023
@vooon vooon added the bug label Feb 22, 2023
@vooon vooon merged commit 6e86500 into mavlink:ros2 Feb 22, 2023
ROS2 support automation moved this from TODO to Done Feb 22, 2023
@lopsided98 lopsided98 deleted the ftp-segfault branch February 22, 2023 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
ROS2 support
  
Done
Development

Successfully merging this pull request may close these issues.

ROS2: FTP segfault on list call
2 participants