Skip to content

Commit d436e8e

Browse files
authored
Merge pull request #3024 from aaronjamt/patch-2
[hf seos] Fix buffer overflow
2 parents ebe431b + ff344e6 commit d436e8e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

client/src/cmdhfseos.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ static void generate_command_wrapping(uint8_t *command_Header, int command_heade
202202
uint8_t asn1_tag_mac[2] = {0x8e, 0x08};
203203
uint8_t command_trailer[2] = {0x97, 0x00};
204204
uint8_t padded_command_trailer[block_size - ARRAYLEN(command_trailer)];
205-
padToBlockSize(command_trailer, sizeof(command_trailer), block_size, padded_command_trailer);
205+
padToBlockSize(command_trailer, sizeof(command_trailer), sizeof(padded_command_trailer), padded_command_trailer);
206206

207207
uint8_t toEncrypt[ARRAYLEN(rndCounter) + ARRAYLEN(padded_Command_Header) + ARRAYLEN(asn1_tag_cryptograph) + ARRAYLEN(padded_encrypted_Command) + ARRAYLEN(padded_command_trailer)];
208208

@@ -290,8 +290,8 @@ static int seos_get_data(uint8_t *rndICC, uint8_t *rndIFD, uint8_t *diversified_
290290
// Convert command from buffer to stream
291291
uint8_t command_convert[command_len];
292292
memcpy(command_convert, command_buffer, command_len);
293-
char completedCommandChar[sizeof(command_len) * 2 + 1];
294-
for (int i = 0; i < sizeof(command_convert); i++) {
293+
char completedCommandChar[command_len * 2 + 1];
294+
for (int i = 0; i < command_len; i++) {
295295
snprintf(&completedCommandChar[i * 2], 3, "%02X", command_convert[i]);
296296
}
297297
// PrintAndLogEx(SUCCESS, "Command.......................... " _YELLOW_("%s"), completedCommandChar);

0 commit comments

Comments
 (0)