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:
Beat Küng
2024-05-07 07:26:12 +02:00
parent f16115d8be
commit f002b08e6a
+1 -1
View File
@@ -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;