In console.c, in console_process() around line 700, static analysis tools pick up an unsafe usage of strcpy. After review, it is probably not a problem as both m_line_buffer and history_line are declared as fixed length arrays of the same size, but even only a disposition complicates the certification of safety-critical systems.
One possible option would be to wipe m_line_buffer with '\0' then using strncpy limited to the length of m_line_buffer, like:
memset(m_line_buffer, '\0', sizeof(m_line_buffer));
strncpy(m_line_buffer, history_line, sizeof(m_line_buffer)-1);
This would ensure that m_line_buffer is always null-terminated no matter what.
However, this requires review as it may conflict with erase_current_line() called before.
In console.c, in
console_process()around line 700, static analysis tools pick up an unsafe usage of strcpy. After review, it is probably not a problem as bothm_line_bufferandhistory_lineare declared as fixed length arrays of the same size, but even only a disposition complicates the certification of safety-critical systems.One possible option would be to wipe
m_line_bufferwith'\0'then usingstrncpylimited to the length ofm_line_buffer, like:This would ensure that
m_line_bufferis always null-terminated no matter what.However, this requires review as it may conflict with
erase_current_line()called before.