Skip to content

Commit

Permalink
Enlarge ConfigAreaAddress size to avoid overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
HexRabbit committed Jun 13, 2020
1 parent 928cc10 commit 9720e7e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Firmware/Chameleon-Mini/Application/MifareUltralight.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ void MifareUltralightAppInit(void) {
}

static void AppInitEV1Common(void) {
uint8_t ConfigAreaAddress = PageCount * MIFARE_ULTRALIGHT_PAGE_SIZE - CONFIG_AREA_SIZE;
uint16_t ConfigAreaAddress = PageCount * MIFARE_ULTRALIGHT_PAGE_SIZE - CONFIG_AREA_SIZE;
uint8_t Access;

/* Set up the emulation flavor */
Expand All @@ -205,7 +205,7 @@ static void AppInitEV1Common(void) {
}

static void AppInitNTAG215Common(void) {
uint8_t ConfigAreaAddress = PageCount * MIFARE_ULTRALIGHT_PAGE_SIZE - CONFIG_AREA_SIZE;
uint16_t ConfigAreaAddress = PageCount * MIFARE_ULTRALIGHT_PAGE_SIZE - CONFIG_AREA_SIZE;
uint8_t Access;

/* Set up the emulation flavor */
Expand Down Expand Up @@ -481,7 +481,7 @@ static uint16_t AppProcess(uint8_t *const Buffer, uint16_t ByteCount) {
}

case CMD_PWD_AUTH: {
uint8_t ConfigAreaAddress = PageCount * MIFARE_ULTRALIGHT_PAGE_SIZE - CONFIG_AREA_SIZE;
uint16_t ConfigAreaAddress = PageCount * MIFARE_ULTRALIGHT_PAGE_SIZE - CONFIG_AREA_SIZE;
uint8_t Password[4];

/* Verify value and increment authentication attempt counter */
Expand Down Expand Up @@ -554,7 +554,7 @@ static uint16_t AppProcess(uint8_t *const Buffer, uint16_t ByteCount) {
return (1 + ISO14443A_CRCA_SIZE) * 8;

case CMD_VCSL: {
uint8_t ConfigAreaAddress = PageCount * MIFARE_ULTRALIGHT_PAGE_SIZE - CONFIG_AREA_SIZE;
uint16_t ConfigAreaAddress = PageCount * MIFARE_ULTRALIGHT_PAGE_SIZE - CONFIG_AREA_SIZE;
/* Input is ignored completely */
/* Read out the value */
MemoryReadBlock(Buffer, ConfigAreaAddress + CONF_VCTID_OFFSET, 1);
Expand Down

0 comments on commit 9720e7e

Please sign in to comment.