Fix a bunch of potential buffer overruns with CLIGetStrWithReturn :
Most prominent one was "lf pac clone --cn 123456789" causing garbage on the terminal Some changed code was valid before but as ppl tend to copy-paste to new code, better to uniformize and document usages of CLIGetStrWithReturn. Exceptions left are when filling real buffers (bin, raw,...), not strings.
This commit is contained in:
1 parent
78510f33a0
commit
153064ddfa
16 files changed
+31
-29
No files matched your search
+1
-1
@@ -1358,8 +1358,8 @@ static int CmdConnect(const char *Cmd) {
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
int p_len = FILE_PATH_SIZE;
|
||||
char port[FILE_PATH_SIZE] = {0};
|
||||
int p_len = sizeof(port) - 1; // CLIGetStrWithReturn does not guarantee string to be null-terminated;
|
||||
CLIGetStrWithReturn(ctx, 1, (uint8_t *)port, &p_len);
|
||||
uint32_t baudrate = arg_get_u32_def(ctx, 2, USART_BAUD_RATE);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
Reference in new issue
Block a user