diydrones/apm_planner — pull request #304 by rolandbosa (2014-04-18 06:41:23+00:00)
Title: Bugfix: Potential buffer overflow in memcpy().

While scanning the code I came across this particular memcpy(), which seems to use
the wrong function to calculate the number of bytes to copy. The correct function to use
is qMin(), to avoid the buffer overflow.

Also, according to the comments in the header file for the structure, it is ok to fill the field
up to the very last byte and omit the terminating zero-byte. I didn't take the time to go into
the details on the receiving side and validate that the comment actually is implemented.
So to err on the safe side, this code still hardcodes a terminating zero-byte at the end of
the name, just to make sure.

Lastly, this code compiles, but I haven't found a way to exercise it. Please review thoroughly.