From 36603818d107729efe7e8d3c302e65da4984a6c7 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Thu, 25 Apr 2024 07:29:22 +0200 Subject: [PATCH] fixed a valgrind memory usage of uninitialised array --- CHANGELOG.md | 1 + client/src/cmdlf.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2226e4873..0787a910a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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... ## [unreleased][unreleased] +- Fix `lf cmdread` - uninitialised memory usage (@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 calyso` - try to read out all data from a Calypso card (@iceman1001) diff --git a/client/src/cmdlf.c b/client/src/cmdlf.c index bf4fa1cb1..ef7fb4e86 100644 --- a/client/src/cmdlf.c +++ b/client/src/cmdlf.c @@ -289,8 +289,9 @@ int CmdLFCommandRead(const char *Cmd) { bool cm = arg_get_lit(ctx, 10); CLIParserFree(ctx); - if (g_session.pm3_present == false) + if (g_session.pm3_present == false) { return PM3_ENOTTY; + } #define PAYLOAD_HEADER_SIZE (12 + (3 * LF_CMDREAD_MAX_EXTRA_SYMBOLS)) struct p { @@ -311,6 +312,7 @@ int CmdLFCommandRead(const char *Cmd) { payload.keep_field_on = keep_field_on; payload.verbose = verbose; 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)) { // Hitag 1, Hitag S, ZX8211