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
@@ -442,8 +442,8 @@ static int CmdHF14AJookiDecode(const char *Cmd) {
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
int dlen = 16;
|
||||
uint8_t b64[JOOKI_B64_LEN] = {0x00};
|
||||
int dlen = sizeof(b64) - 1; // CLIGetStrWithReturn does not guarantee string to be null-terminated
|
||||
memset(b64, 0x0, sizeof(b64));
|
||||
CLIGetStrWithReturn(ctx, 1, b64, &dlen);
|
||||
bool verbose = arg_get_lit(ctx, 2);
|
||||
@@ -471,8 +471,8 @@ static int CmdHF14AJookiSim(const char *Cmd) {
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
int dlen = 16;
|
||||
uint8_t b64[JOOKI_B64_LEN] = {0x00};
|
||||
int dlen = sizeof(b64) - 1; // CLIGetStrWithReturn does not guarantee string to be null-terminated
|
||||
memset(b64, 0x0, sizeof(b64));
|
||||
CLIGetStrWithReturn(ctx, 1, b64, &dlen);
|
||||
CLIParserFree(ctx);
|
||||
@@ -611,8 +611,8 @@ static int CmdHF14AJookiClone(const char *Cmd) {
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
int blen = 16;
|
||||
uint8_t b64[JOOKI_B64_LEN] = {0x00};
|
||||
int blen = sizeof(b64) - 1; // CLIGetStrWithReturn does not guarantee string to be null-terminated
|
||||
memset(b64, 0x0, sizeof(b64));
|
||||
CLIGetStrWithReturn(ctx, 1, b64, &blen);
|
||||
|
||||
|
||||
Reference in new issue
Block a user