mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-25 15:45:26 -07:00
make sure size_t doesnt overflow an int
This commit is contained in:
parent
c97f003b2f
commit
c08c2dcf3a
1 changed files with 3 additions and 1 deletions
|
@ -716,7 +716,8 @@ static const uint8_t jpeg_header[4] = { 0xFF, 0xD8, 0xFF, 0xE0 };
|
||||||
static const uint8_t jpeg2k_header[6] = { 0x00, 0x00, 0x00, 0x0C, 0x6A, 0x50 };
|
static const uint8_t jpeg2k_header[6] = { 0x00, 0x00, 0x00, 0x0C, 0x6A, 0x50 };
|
||||||
|
|
||||||
static int emrtd_dump_ef_dg2(uint8_t *file_contents, size_t file_length, const char *path) {
|
static int emrtd_dump_ef_dg2(uint8_t *file_contents, size_t file_length, const char *path) {
|
||||||
int offset, datalen = 0;
|
size_t offset;
|
||||||
|
int datalen = 0;
|
||||||
|
|
||||||
// This is a hacky impl that just looks for the image header. I'll improve it eventually.
|
// This is a hacky impl that just looks for the image header. I'll improve it eventually.
|
||||||
// based on mrpkey.py
|
// based on mrpkey.py
|
||||||
|
@ -738,6 +739,7 @@ static int emrtd_dump_ef_dg2(uint8_t *file_contents, size_t file_length, const c
|
||||||
char *filepath = calloc(strlen(path) + 100, sizeof(char));
|
char *filepath = calloc(strlen(path) + 100, sizeof(char));
|
||||||
if (filepath == NULL)
|
if (filepath == NULL)
|
||||||
return PM3_EMALLOC;
|
return PM3_EMALLOC;
|
||||||
|
|
||||||
strcpy(filepath, path);
|
strcpy(filepath, path);
|
||||||
strncat(filepath, PATHSEP, 2);
|
strncat(filepath, PATHSEP, 2);
|
||||||
strcat(filepath, dg_table[EF_DG2].filename);
|
strcat(filepath, dg_table[EF_DG2].filename);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue