fixed a valgrind memory usage of uninitialised array

This commit is contained in:
iceman1001 2024-04-25 07:29:22 +02:00
commit 36603818d1
2 changed files with 4 additions and 1 deletions

View file

@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
## [unreleased][unreleased] ## [unreleased][unreleased]
- Fix `lf cmdread` - uninitialised memory usage (@iceman1001)
- Changed `hf st info` - now tries to check signature if available (@iceman1001) - Changed `hf st info` - now tries to check signature if available (@iceman1001)
- Added `hf 14b mobib` - try to read out all data from a MOBIB card (@iceman1001) - Added `hf 14b mobib` - try to read out all data from a MOBIB card (@iceman1001)
- Added `hf 14b calyso` - try to read out all data from a Calypso card (@iceman1001) - Added `hf 14b calyso` - try to read out all data from a Calypso card (@iceman1001)

View file

@ -289,8 +289,9 @@ int CmdLFCommandRead(const char *Cmd) {
bool cm = arg_get_lit(ctx, 10); bool cm = arg_get_lit(ctx, 10);
CLIParserFree(ctx); CLIParserFree(ctx);
if (g_session.pm3_present == false) if (g_session.pm3_present == false) {
return PM3_ENOTTY; return PM3_ENOTTY;
}
#define PAYLOAD_HEADER_SIZE (12 + (3 * LF_CMDREAD_MAX_EXTRA_SYMBOLS)) #define PAYLOAD_HEADER_SIZE (12 + (3 * LF_CMDREAD_MAX_EXTRA_SYMBOLS))
struct p { struct p {
@ -311,6 +312,7 @@ int CmdLFCommandRead(const char *Cmd) {
payload.keep_field_on = keep_field_on; payload.keep_field_on = keep_field_on;
payload.verbose = verbose; payload.verbose = verbose;
memset(payload.symbol_extra, 0, sizeof(payload.symbol_extra)); memset(payload.symbol_extra, 0, sizeof(payload.symbol_extra));
memset(payload.period_extra, 0, sizeof(payload.period_extra));
if (add_crc_ht && (cmd_len <= 120)) { if (add_crc_ht && (cmd_len <= 120)) {
// Hitag 1, Hitag S, ZX8211 // Hitag 1, Hitag S, ZX8211