mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 12:43:34 +08:00
logger: don't use uint8_t buffer[msg_size]; (it's C99 not C++)
Also, it's not clear where the allocation was. It looks like it was on the heap, but the compiler could decide to put it on the stack. This is very bad for us because we use fixed size stacks with tights bounds. So if a user specifies a large topic to log, it could have crashed. Now the allocation is on the heap and the user can specify any size of topic to log (as long as there is enough memory).
This commit is contained in:
@@ -195,6 +195,8 @@ private:
|
||||
static constexpr const char *LOG_ROOT = PX4_ROOTFSDIR"/fs/microsd/log";
|
||||
#endif
|
||||
|
||||
uint8_t *_msg_buffer = nullptr;
|
||||
int _msg_buffer_len = 0;
|
||||
bool _task_should_exit = true;
|
||||
char _log_dir[64];
|
||||
bool _has_log_dir = false;
|
||||
|
||||
Reference in New Issue
Block a user