From 18cbc7259ca396dea0c99ce9547e0e51370a347c Mon Sep 17 00:00:00 2001 From: Henry Gabryjelski Date: Sun, 5 May 2024 16:00:16 -0700 Subject: [PATCH] prevent sending corrupt data to em4x70 tags --- armsrc/em4x70.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/armsrc/em4x70.c b/armsrc/em4x70.c index 05f08d6bc..d372efe77 100644 --- a/armsrc/em4x70.c +++ b/armsrc/em4x70.c @@ -744,6 +744,13 @@ void em4x70_write(const em4x70_data_t *etd, bool ledcontrol) { command_parity = etd->parity; + // Disable to prevent sending corrupted data to the tag. + if (command_parity) { + Dbprintf("Use of `--par` option with `lf em 4x70 write` is disabled to prevent corrupting tag data"); + reply_ng(CMD_LF_EM4X70_WRITE, PM3_ENOTIMPL, NULL, 0); + return; + } + init_tag(); em4x70_setup_read(); @@ -808,6 +815,13 @@ void em4x70_auth(const em4x70_data_t *etd, bool ledcontrol) { command_parity = etd->parity; + // Disable to prevent sending corrupted data to the tag. + if (command_parity) { + Dbprintf("Use of `--par` option with `lf em 4x70 auth` is disabled to prevent corrupting tag data"); + reply_ng(CMD_LF_EM4X70_WRITE, PM3_ENOTIMPL, NULL, 0); + return; + } + init_tag(); em4x70_setup_read(); @@ -829,6 +843,13 @@ void em4x70_brute(const em4x70_data_t *etd, bool ledcontrol) { command_parity = etd->parity; + // Disable to prevent sending corrupted data to the tag. + if (command_parity) { + Dbprintf("Use of `--par` option with `lf em 4x70 brute` is disabled to prevent corrupting tag data"); + reply_ng(CMD_LF_EM4X70_WRITE, PM3_ENOTIMPL, NULL, 0); + return; + } + init_tag(); em4x70_setup_read(); @@ -850,6 +871,13 @@ void em4x70_write_pin(const em4x70_data_t *etd, bool ledcontrol) { command_parity = etd->parity; + // Disable to prevent sending corrupted data to the tag. + if (command_parity) { + Dbprintf("Use of `--par` option with `lf em 4x70 setpin` is disabled to prevent corrupting tag data"); + reply_ng(CMD_LF_EM4X70_WRITE, PM3_ENOTIMPL, NULL, 0); + return; + } + init_tag(); em4x70_setup_read(); @@ -892,6 +920,13 @@ void em4x70_write_key(const em4x70_data_t *etd, bool ledcontrol) { command_parity = etd->parity; + // Disable to prevent sending corrupted data to the tag. + if (command_parity) { + Dbprintf("Use of `--par` option with `lf em 4x70 setkey` is disabled to prevent corrupting tag data"); + reply_ng(CMD_LF_EM4X70_WRITE, PM3_ENOTIMPL, NULL, 0); + return; + } + init_tag(); em4x70_setup_read();