Skip to content

Commit

Permalink
Fix corrupt file handling #193
Browse files Browse the repository at this point in the history
  • Loading branch information
phaag committed Nov 8, 2019
1 parent c5db2c7 commit c2a976e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ChangeLog
@@ -1,3 +1,6 @@
2019-11-08
- Fix corrupt file handling #193

2019-11-03
- More code cleanup. Move code to dedicated files.

Expand Down
3 changes: 2 additions & 1 deletion bin/nffile.c
Expand Up @@ -1077,7 +1077,8 @@ uint32_t compression;
read_bytes = ret;

// Check for sane buffer size
if ( nffile->block_header->size > BUFFSIZE ) {
if ( nffile->block_header->size > BUFFSIZE ||
nffile->block_header->size == 0 || nffile->block_header->NumRecords == 0) {
// this is most likely a corrupt file
LogError("Corrupt data file: Requested buffer size %u exceeds max. buffer size.\n", nffile->block_header->size);
return NF_CORRUPT;
Expand Down

0 comments on commit c2a976e

Please sign in to comment.