Fix heap out-of-bounds read in hf xerox view on short dump files
This commit is contained in:
1 parent
6d2c35b05b
commit
18936b2188
2 files changed
+14
No files matched your search
@@ -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...
|
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]
|
## [unreleased][unreleased]
|
||||||
|
- Fixed `hf xerox view` - now rejects a dump file too small to contain the info blocks instead of reading past it (@munzzyy)
|
||||||
- Changed NG frame layout to align better with 64bytes frames. From 512 -> 624bytes (@iceman1001)
|
- Changed NG frame layout to align better with 64bytes frames. From 512 -> 624bytes (@iceman1001)
|
||||||
- Changed `hf plot` - converted to NG frame (@iceman1001)
|
- Changed `hf plot` - converted to NG frame (@iceman1001)
|
||||||
- Fixed `hf mfu cchk` - now 3-pass key check all keys sent to device (@iceman1001)
|
- Fixed `hf mfu cchk` - now 3-pass key check all keys sent to device (@iceman1001)
|
||||||
|
|||||||
@@ -952,6 +952,19 @@ static int CmdHFXeroxView(const char *Cmd) {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t info_max_block = 0;
|
||||||
|
for (uint8_t i = 0; i < ARRAYLEN(info_blocks); i++) {
|
||||||
|
if (info_blocks[i] > info_max_block) {
|
||||||
|
info_max_block = info_blocks[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
size_t info_min = (info_max_block + 1) * XEROX_BLOCK_SIZE;
|
||||||
|
if (bytes_read < info_min) {
|
||||||
|
PrintAndLogEx(FAILED, "Error, dump file is too small to be a valid Xerox dump - bytes: %zu, expected at least: %zu", bytes_read, info_min);
|
||||||
|
free(dump);
|
||||||
|
return PM3_EFILE;
|
||||||
|
}
|
||||||
|
|
||||||
uint16_t blockno = bytes_read / XEROX_BLOCK_SIZE;
|
uint16_t blockno = bytes_read / XEROX_BLOCK_SIZE;
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
|
|||||||
Reference in new issue
Block a user