mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-22 07:44:03 -04:00
AP_Logger: fix extremely unlikely nullptr dereference in SITL sanity checks
This commit is contained in:
parent
75b133926f
commit
aeb45bf146
@ -349,7 +349,11 @@ void AP_Logger_Backend::validate_WritePrioritisedBlock(const void *pBuffer,
|
||||
}
|
||||
if (type_len != size) {
|
||||
char name[5] = {}; // get a null-terminated string
|
||||
memcpy(name, s->name, 4);
|
||||
if (s->name != nullptr) {
|
||||
memcpy(name, s->name, 4);
|
||||
} else {
|
||||
strncpy(name, "?NM?", ARRAY_SIZE(name));
|
||||
}
|
||||
AP_HAL::panic("Size mismatch for %u (%s) (expected=%u got=%u)\n",
|
||||
type, name, type_len, size);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user