ros_comm icon indicating copy to clipboard operation
ros_comm copied to clipboard

fix error in base64EncodedSize()

Open mjs973 opened this issue 3 years ago • 2 comments

I have been debugging an issue where no messages are delivered over UDP Transport. I'm on melodic, ubuntu 18.04, x86_64 cpu. Here is what I found.

The base64 encoder called by XmlRpcValue.cpp may write two newlines to the end of the encoded string, but this is not accounted for in base64EncodedSize(). This results in a buffer overflow, which then causes ROS UDP Transport connection setup to fail.

One case which results in the double newline is when the total length of "node_name + topic_name + msg_type" is 33 bytes.

mjs973 avatar Jun 18 '21 15:06 mjs973

Thanks for the patch! Could you provide a complete code example that I can run to verify the bug and fix?

Also, could you target the latest development branch (noetic-devel), and then I'll backport the fix to Melodic.

jacobperron avatar Sep 01 '21 18:09 jacobperron

I've had this same issue in ROS noetic, my question with a code example that you can run is here: https://robotics.stackexchange.com/questions/104346/issue-with-rostopic-name-length-affecting-node-communication)

JavierUbago avatar Sep 28 '23 07:09 JavierUbago