From e3b5759ee4ffe37aa298cc696721e9469adb3690 Mon Sep 17 00:00:00 2001 From: ckolivas Date: Tue, 8 Mar 2011 11:41:15 +1100 Subject: [PATCH] Check for any unusual entries in get_fileinfo and abort. --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 86adc9f..094a589 100644 --- a/main.c +++ b/main.c @@ -557,8 +557,8 @@ next_chunk: if (unlikely(head_off = lseek(fd_in, last_head + ofs, SEEK_SET)) == -1) fatal("Failed to seek to header data in get_fileinfo\n"); get_header_info(fd_in, &ctype, &c_len, &u_len, &last_head); - if (unlikely(last_head < 0)) - failure("Last head entry negative, likely corrupted archive.\n"); + if (unlikely(last_head < 0 || c_len < 0 || u_len < 0)) + failure("Entry negative, likely corrupted archive.\n"); print_output("%d\t", block); if (ctype == CTYPE_NONE) print_output("none");