This pull request fixes a buffer overflow error, which I observed on Ubuntu 14.04 with ROS Indigo. The backtrace and memory maps for the error are shown below:
This failure, to my understanding is identical to #3 and is caused when the changeMotorSpeed function is called. The cause of the failure is the size of the cmd and speed buffers being smaller than required - the size does not account for the string terminating \0 character.
The compiler warning that led to this bugfix is as follows:
In function ‘char* strcpy(char*, const char*)’,
inlined from ‘void SweepDriver::_getSpeedValue(uint8_t, char*)’ at /home/bhavya/Maidbot/catkin_ws/src/sweep-ros/sweep-sdk-cpp/src/sweep_driver.cc:684:32,
inlined from ‘status SweepDriver::changeMotorSpeed(uint8_t)’ at /home/bhavya/Maidbot/catkin_ws/src/sweep-ros/sweep-sdk-cpp/src/sweep_driver.cc:268:33:
/usr/include/x86_64-linux-gnu/bits/string3.h:104:63: warning: call to void* __builtin___memcpy_chk(void*, const void*, long unsigned int, long unsigned int) will always overflow destination buffer [enabled by default]
return __builtin___strcpy_chk (__dest, __src, __bos (__dest));
This pull request fixes a buffer overflow error, which I observed on Ubuntu 14.04 with ROS Indigo. The backtrace and memory maps for the error are shown below:
This failure, to my understanding is identical to #3 and is caused when the
changeMotorSpeed
function is called. The cause of the failure is the size of thecmd
andspeed
buffers being smaller than required - the size does not account for the string terminating\0
character.The compiler warning that led to this bugfix is as follows: