diff options
Diffstat (limited to 'Utilities/cmbzip2/bzip2recover.c')
-rw-r--r-- | Utilities/cmbzip2/bzip2recover.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Utilities/cmbzip2/bzip2recover.c b/Utilities/cmbzip2/bzip2recover.c index 6e47b60..a8131e0 100644 --- a/Utilities/cmbzip2/bzip2recover.c +++ b/Utilities/cmbzip2/bzip2recover.c @@ -7,8 +7,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.5 of 10 December 2007 - Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org> + bzip2/libbzip2 version 1.0.8 of 13 July 2019 + Copyright (C) 1996-2019 Julian Seward <jseward@acm.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. @@ -18,7 +18,7 @@ ------------------------------------------------------------------ */ /* This program is a complete hack and should be rewritten properly. - It isn't very complicated. */ + It isn't very complicated. */ #include <stdio.h> #include <errno.h> @@ -309,11 +309,12 @@ Int32 main ( Int32 argc, Char** argv ) UInt32 buffHi, buffLo, blockCRC; Char* p; - strcpy ( progName, argv[0] ); + strncpy ( progName, argv[0], BZ_MAX_FILENAME-1); + progName[BZ_MAX_FILENAME-1]='\0'; inFileName[0] = outFileName[0] = 0; fprintf ( stderr, - "bzip2recover 1.0.5: extracts blocks from damaged .bz2 files.\n" ); + "bzip2recover 1.0.8: extracts blocks from damaged .bz2 files.\n" ); if (argc != 2) { fprintf ( stderr, "%s: usage is `%s damaged_file_name'.\n", @@ -393,7 +394,7 @@ Int32 main ( Int32 argc, Char** argv ) bEnd[currBlock] = 0; } if (currBlock > 0 && - (bEnd[currBlock] - bStart[currBlock]) >= 130) { + (bEnd[currBlock] - bStart[currBlock]) >= 130) { fprintf ( stderr, " block %d runs from " MaybeUInt64_FMT " to " MaybeUInt64_FMT "\n", rbCtr+1, bStart[currBlock], bEnd[currBlock] ); @@ -457,6 +458,7 @@ Int32 main ( Int32 argc, Char** argv ) bsPutUChar ( bsWr, 0x50 ); bsPutUChar ( bsWr, 0x90 ); bsPutUInt32 ( bsWr, blockCRC ); bsClose ( bsWr ); + outFile = NULL; } if (wrBlock >= rbCtr) break; wrBlock++; @@ -474,8 +476,8 @@ Int32 main ( Int32 argc, Char** argv ) split = outFileName; } else { ++split; - } - /* Now split points to the start of the basename. */ + } + /* Now split points to the start of the basename. */ ofs = split - outFileName; sprintf (split, "rec%5d", wrBlock+1); for (p = split; *p != 0; p++) if (*p == ' ') *p = '0'; |