Check for any unusual entries in get_fileinfo and abort.

This commit is contained in:
ckolivas 2011-03-08 11:41:15 +11:00
parent c205d06829
commit e3b5759ee4

4
main.c
View file

@ -557,8 +557,8 @@ next_chunk:
if (unlikely(head_off = lseek(fd_in, last_head + ofs, SEEK_SET)) == -1) if (unlikely(head_off = lseek(fd_in, last_head + ofs, SEEK_SET)) == -1)
fatal("Failed to seek to header data in get_fileinfo\n"); fatal("Failed to seek to header data in get_fileinfo\n");
get_header_info(fd_in, &ctype, &c_len, &u_len, &last_head); get_header_info(fd_in, &ctype, &c_len, &u_len, &last_head);
if (unlikely(last_head < 0)) if (unlikely(last_head < 0 || c_len < 0 || u_len < 0))
failure("Last head entry negative, likely corrupted archive.\n"); failure("Entry negative, likely corrupted archive.\n");
print_output("%d\t", block); print_output("%d\t", block);
if (ctype == CTYPE_NONE) if (ctype == CTYPE_NONE)
print_output("none"); print_output("none");