mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 19:33:35 +08:00
mavlink_ftp: ensure there's enough space for the 2. path in _workRename
Prevents accessing invalid memory when reading ptr + oldpath_sz + 1 and oldpath_sz fills out the whole or N-1 bytes of the payload.
This commit is contained in:
@@ -838,7 +838,7 @@ MavlinkFTP::_workRename(PayloadHeader *payload)
|
||||
char *ptr = _data_as_cstring(payload);
|
||||
size_t oldpath_sz = strlen(ptr);
|
||||
|
||||
if (oldpath_sz == payload->size) {
|
||||
if (oldpath_sz + 2 >= payload->size) {
|
||||
// no newpath
|
||||
errno = EINVAL;
|
||||
return kErrFailErrno;
|
||||
|
||||
Reference in New Issue
Block a user