Commit Graph

186 Commits

Author SHA1 Message Date
christos 3b9b386971 use the data size in case stdout was a pipe (M. Levinson) 2018-11-11 01:42:36 +00:00
christos 3e167e7237 fix typo. 2018-10-29 00:14:37 +00:00
christos bc30e841a8 handle stdin with header partially read. 2018-10-27 23:40:04 +00:00
christos 92e36ceeff remove debugging. 2018-10-27 13:20:21 +00:00
kre 5a5ac0a56f Fix printf conversion of off_t for 32 bit hosts (fix i386 build)
(%td is for ptrdiff_t)
2018-10-27 11:52:26 +00:00
skrll ef95ae4a36 Fix previous 2018-10-27 11:39:12 +00:00
christos 41c9b009a9 Add lzip support to gzip based on the example lzip decoder. 2018-10-26 22:10:15 +00:00
martin 3871bbe7ed Add -l support for xz files 2018-10-06 16:36:45 +00:00
kamil 2760f15b81 Correct Undefined Behavior in gzip(1)
Unportable left shift reported with MKSANITIZER=yes USE_SANITIZER=undefined:

# progress -zf ./games.tgz  tar -xp -C "./" -f -
/public/src.git/usr.bin/gzip/gzip.c:2126:33: runtime error: left shift of 251 by 24 places cannot be represented in type 'int'
100% |****************************************************************************************************************| 44500 KiB  119.69 MiB/s    00:00 ETA


Refactor the following code into something that is more clear
and fix signed integer shift, by casting all buf[] elements to
(unsigned int):

unsigned char buf[8];
uint32_t usize;
[...]
else {
    usize = buf[4] | buf[5] << 8 |
            buf[6] << 16 | buf[7] << 24;
[...]

New version:

    usize = buf[4];
    usize |= (unsigned int)buf[5] << 8;
    usize |= (unsigned int)buf[6] << 16;
    usize |= (unsigned int)buf[7] << 24;

Only the "<< 24" part needs explicit cast, but for consistency make the
integer promotion explicit and clear to a code reader.

Sponsored by <The NetBSD Foundation>
2018-06-12 00:42:17 +00:00
abhinav b3e27e93ee Add gunzip and zcat to the NAME section as well 2017-10-22 17:36:49 +00:00
christos 13a9a3bb6f now that we are processing SIGINFO write can be interrupted and return
partial results (well, it could before too but it was harder to trigger);
provide write_fully like we have read_fully already.
2017-08-23 13:04:17 +00:00
mrg 5e22a92ec6 add SIGINFO support. 2017-08-04 07:27:08 +00:00
mrg 99f85f4578 update copyright strings. 2017-06-03 21:28:48 +00:00
wiz 4e70675da5 Document --keep. From Timo Buhrmester <fstd.lkml@gmail.com> on netbsd-docs.
Use more macros while here.
2017-01-08 14:18:31 +00:00
christos 5fa7ae025c remove clauses 3, 4 2016-01-29 15:19:01 +00:00
mrg 60c6cf919b port across the change from freebsd rev 290024:
In gunzip(1), treat trailing garbage as a warning and not an error.  This
allows scripts to distinguish it between real fatal errors, for instance a
CRC mismatch.

Update manual page for the behavior change.

PR:		bin/203873
Submitted by:	Eugene Grosbein <eugen grosbein net>
MFC after:	2 weeks
2015-10-27 07:36:18 +00:00
nakayama dafd5f4472 zgrep(1): suppress the prefixing of filename on output when only
one file is specified to match the grep(1)'s output.
2015-07-06 12:05:40 +00:00
christos d6eaf99167 Coverity CID 1264915, Via FreeBSD (Xin Li)
When reading in the original file name from gzip header, we read
in PATH_MAX + 1 bytes from the file.  In r281500, strrchr() is
used to strip possible path portion of the file name to mitigate
a possible attack.  Unfortunately, strrchr() expects a buffer
that is NUL-terminated, and since we are processing potentially
untrusted data, we can not assert that be always true.

Solve this by reading in one less byte (now PATH_MAX) and
explicitly terminate the buffer after the read size with NUL.
2015-04-15 02:29:12 +00:00
wiz 75bbcb9aa1 Document xz decompression support better. From Joachim Henke on netbsd-docs. 2015-04-06 21:41:17 +00:00
mrg a1b1261ab6 do not use directory paths present in gzip files with the -N flag,
similar to the problem reported in pigz.
2015-01-13 02:37:20 +00:00
snj f0a7346d21 src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
2014-10-18 08:33:23 +00:00
riastradh 6cb10275d0 Merge riastradh-drm2 to HEAD. 2014-03-18 18:20:35 +00:00
pettai 515a14aba7 fix == compatibility problem 2013-12-06 13:33:15 +00:00
pettai 67f944d13d Add zfgrep that fell off from last update 2013-11-13 11:12:24 +00:00
pettai 54844dd551 Added zless(1) - comes in the lastest version of zmore(1) from OpenBSD
(OKed by tron@)
2013-11-12 21:58:37 +00:00
pgoyette d96eb15780 fferentiate zegrep and zfgrep by their basename only, so they can be
invoked with a pathname (ie, /usr/bin/z{e,f}grep).

OK wiz@
2013-07-25 12:25:23 +00:00
wiz a5684d07dd Use Mt for email addresses. 2013-07-20 21:39:55 +00:00
christos 22d49ff4f1 add copyright 2011-09-30 01:32:21 +00:00
joerg 7e57d8fe3f Use __printflike and __dead. 2011-08-30 23:06:00 +00:00
christos 4802a96d70 fix non-literal format strings 2011-08-17 14:07:45 +00:00
christos 90f7aa069d add noreturn atttribute. 2011-08-17 14:07:31 +00:00
joerg 09b543b065 Do proper input validation without penalizing performance. 2011-08-16 13:55:01 +00:00
christos 4a313422fa set errno on overflow return. 2011-08-16 03:25:34 +00:00
christos 5db8b1f126 provisional fix for CVS-2011-2895, buffer overflow when uncompressing 2011-08-16 03:21:47 +00:00
joerg 8cba5925cb Add a few explicit casts for sign mismatches. 2011-06-21 13:25:45 +00:00
mrg 75e42fa7da remove most of the remaining HAVE_GCC tests that are always true in
the modern world.
2011-06-20 07:43:56 +00:00
christos b3e9080143 cross reference xz.1 2011-06-19 02:22:36 +00:00
christos 9593a36e94 make this work:
- forgot to account for prelen in the input length
- deal with EOF properly
2011-06-19 02:19:45 +00:00
christos 5708f444da recognize .xz suffix 2011-06-19 02:19:09 +00:00
christos 255ae88a08 - remove unused call
- read headers separately
- print error id.
2011-06-19 01:52:28 +00:00
tsutsui 7c8d31ee49 XZ_SUPPORT requires maybe_errx(). 2011-06-19 01:20:19 +00:00
christos 40b41259f0 Add lzma (.xz) support. Somehow this does not decode after the first read yet. 2011-06-19 00:43:54 +00:00
tsutsui 784931d63b Fix OPT_LIST. -t is not available in SMALL case. 2011-03-23 12:59:44 +00:00
mrg 77a6c12f15 pull across a few changes from the freebsd folks:
http://svn.freebsd.org/changeset/base/213044
	- fixes gunzip issues
http://svn.freebsd.org/changeset/base/213927
	- fixes various typos and comments

and also an older change to add support for bzip2's "-k" option:
	don't delete the input file


thanks!
2010-11-06 21:42:32 +00:00
joerg 70729907f6 Consistently use -- for all programs called. Drop some redundant flags
for the no file argument case.
2010-04-14 20:30:28 +00:00
wiz 10b9fb64b7 Sort SEE ALSO, fix an xref. 2010-04-14 19:52:05 +00:00
joerg 68128a5628 Refactor zdiff and extend functionality to the common suffixes for bzip2
and xz.
2010-04-14 18:55:12 +00:00
mrg 59c18d14fe apply a change from Xin LI <delphij@delphij.net> to avoid problems when
reading from pipes.  introduced with the multi-part bz2 fixes.
2009-12-05 03:23:37 +00:00
mrg 5e3404f76c update version to today. 2009-10-11 09:17:21 +00:00
mrg 205ea56f45 avoid an overflow in suffix handling, from Xin LI <delphij@delphij.net>. 2009-10-11 07:09:39 +00:00