OpenBSD CVS

CVS log for src/bin/pax/pat_rep.c


[BACK] Up to [local] / src / bin / pax

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.45 / (download) - annotate - [select for diffs], Mon Jun 26 07:10:17 2023 UTC (11 months, 2 weeks ago) by op
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, HEAD
Changes since 1.44: +3 -3 lines
Diff to previous 1.44 (colored)

fix grammar of the comment describing pat_chk(); ok millert@

Revision 1.44 / (download) - annotate - [select for diffs], Fri Jan 28 05:15:05 2022 UTC (2 years, 4 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.43: +2 -2 lines
Diff to previous 1.43 (colored)

When it's the possessive of 'it', it's spelled "its", without the
apostrophe.

Revision 1.43 / (download) - annotate - [select for diffs], Sat Sep 16 07:42:34 2017 UTC (6 years, 8 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.42: +2 -2 lines
Diff to previous 1.42 (colored)

Carefully add casts to silence clang sign-compare warnings. ok millert@

Revision 1.42 / (download) - annotate - [select for diffs], Sun Sep 10 18:16:03 2017 UTC (6 years, 9 months ago) by guenther
Branch: MAIN
Changes since 1.41: +4 -1 lines
Diff to previous 1.41 (colored)

Backslash escapes the next character in filename patterns.

ok millert@

Revision 1.41 / (download) - annotate - [select for diffs], Fri Aug 26 04:19:28 2016 UTC (7 years, 9 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.40: +16 -7 lines
Diff to previous 1.40 (colored)

pat_rep.h is only used by pat_rep.c; merge it into the .c file
<sys/time.h>, <errno.h> and <unistd.h> are unnecessary; sort #includes

Revision 1.40 / (download) - annotate - [select for diffs], Tue Nov 17 19:01:34 2015 UTC (8 years, 6 months ago) by mmcc
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.39: +2 -2 lines
Diff to previous 1.39 (colored)

int -> size_t for a len field

ok guenther@, deraadt@

Revision 1.34.4.1 / (download) - annotate - [select for diffs], Thu Apr 30 19:30:57 2015 UTC (9 years, 1 month ago) by guenther
Branch: OPENBSD_5_6
Changes since 1.34: +44 -1 lines
Diff to previous 1.34 (colored) next main 1.35 (colored)

Backport trunk commit of 2015/03/09 04:23:29:
tar/pax/cpio had multiple issues:
 * extracting a malicious archive could create files outside of the
   current directory without using pre-existing symlinks to 'escape',
   and could change the timestamps and modes on preexisting files
 * tar without -P would permit extraction of paths with ".." components
 * there was a buffer overflow in the handling of pax extension headers

Revision 1.37.2.1 / (download) - annotate - [select for diffs], Thu Apr 30 19:28:46 2015 UTC (9 years, 1 month ago) by guenther
Branch: OPENBSD_5_7
Changes since 1.37: +44 -1 lines
Diff to previous 1.37 (colored) next main 1.38 (colored)

Backport trunk commit of 2015/03/09 04:23:29:
tar/pax/cpio had multiple issues:
 * extracting a malicious archive could create files outside of the
   current directory without using pre-existing symlinks to 'escape',
   and could change the timestamps and modes on preexisting files
 * tar without -P would permit extraction of paths with ".." components
 * there was a buffer overflow in the handling of pax extension headers

Revision 1.39 / (download) - annotate - [select for diffs], Tue Mar 17 03:23:17 2015 UTC (9 years, 2 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.38: +11 -10 lines
Diff to previous 1.38 (colored)

Add PAX_IS_{REG,HARDLINK,LINK} macros to simply many file type tests

ok millert@

Revision 1.38 / (download) - annotate - [select for diffs], Mon Mar 9 04:23:29 2015 UTC (9 years, 3 months ago) by guenther
Branch: MAIN
Changes since 1.37: +44 -1 lines
Diff to previous 1.37 (colored)

Unrevert post-unlock:
* Prevent an archive from esacaping the current directory by itself:
  when extracting a symlink whose value is absolute or contains ".."
  components, just create a zero-length normal file (with additional
  tracking of the mode and hardlinks to the symlink) until everything
  else is extracted, then go back and replace it with the requested
  link (if it's still that zero-length placeholder).

* For tar without -P, if a path in the archive has any ".." components
  then strip everything up to and including the last of them (if
  it ends in ".." then it becomes ".")
  This mostly follows GNU tar's behavior, except for 'tar tf' and
  'tar xvf' we report the modified path that would be/was actually
  created instead of the raw path from the archive

  Above two fixes prompted by a report from Daniel Cegielka
  (daniel.cegielka (at) gmail.com)

* For directories whose times or mode will be fixed up in the
  clean-up pass, record their dev+ino and then use
  open(O_DIRECTORY)+fstat() to verify that we're updating the correct
  directory before using futimens() and fchmod().

* Correct buffer overflow in handling of pax extension headers,
  caught by the memcpy() overlap check.


previously ok millert@ deraadt@

Revision 1.37 / (download) - annotate - [select for diffs], Sat Feb 21 22:48:23 2015 UTC (9 years, 3 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE
Branch point for: OPENBSD_5_7
Changes since 1.36: +1 -44 lines
Diff to previous 1.36 (colored)

Recent changes haven't been completely stable, so revert for the 5.7 release

requested by deraadt@

Revision 1.36 / (download) - annotate - [select for diffs], Thu Feb 12 23:44:57 2015 UTC (9 years, 3 months ago) by guenther
Branch: MAIN
Changes since 1.35: +20 -1 lines
Diff to previous 1.35 (colored)

Prevent an archive from esacaping the current directory by itself:
when extracting a symlink whose value is absolute or contains ".."
components, just create a zero-length normal file (with additional
tracking of the mode and hardlinks to the symlink) until everything
else is extracted, then go back and replace it with the requested
link (if its still that zero-length placeholder).

This and previous symlink and ".." path fixes prompted by a report
from Daniel Cegielka (daniel.cegielka (at) gmail.com)

ok millert@

Revision 1.35 / (download) - annotate - [select for diffs], Thu Feb 12 23:01:58 2015 UTC (9 years, 3 months ago) by guenther
Branch: MAIN
Changes since 1.34: +25 -1 lines
Diff to previous 1.34 (colored)

For tar without -P, if a path in the archive has any ".." components then
strip everything up to and including the last of them (if it ends in ".."
then it becomes ".")
This mostly follows GNU tar's behavior, except for 'tar tf' and 'tar xvf'
we report the modified path that was actually created instead of the raw
path from the archive

ok w/tweak millert@, deraadt@

Revision 1.34 / (download) - annotate - [select for diffs], Sat May 24 18:51:00 2014 UTC (10 years ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE
Branch point for: OPENBSD_5_6
Changes since 1.33: +7 -7 lines
Diff to previous 1.33 (colored)

Delete pointless casts: free() return value to (void), free()'s
argument to (char *), and malloc/calloc's return value to the type
of the variable it's being assigned to.
Convert the one calloc() where the zeroing isn't needed to a reallocarray().

ok millert@

Revision 1.33 / (download) - annotate - [select for diffs], Wed Jan 8 04:42:24 2014 UTC (10 years, 5 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.32: +3 -3 lines
Diff to previous 1.32 (colored)

Rename arguments to avoid shadowing global variables

ok fgsch@

Revision 1.32 / (download) - annotate - [select for diffs], Tue Dec 4 02:24:45 2012 UTC (11 years, 6 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.31: +1 -2 lines
Diff to previous 1.31 (colored)

remove some unnecessary sys/param.h inclusions

Revision 1.31 / (download) - annotate - [select for diffs], Tue Oct 27 23:59:22 2009 UTC (14 years, 7 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.30: +1 -9 lines
Diff to previous 1.30 (colored)

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable).  these days, people use source.  these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms

Revision 1.30 / (download) - annotate - [select for diffs], Fri Aug 5 08:30:10 2005 UTC (18 years, 10 months ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2, OPENBSD_4_1_BASE, OPENBSD_4_1, OPENBSD_4_0_BASE, OPENBSD_4_0, OPENBSD_3_9_BASE, OPENBSD_3_9, OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.29: +4 -4 lines
Diff to previous 1.29 (colored)

strip multiple leading slashes from absolute paths; ok beck@

Revision 1.29 / (download) - annotate - [select for diffs], Thu Apr 21 21:47:18 2005 UTC (19 years, 1 month ago) by beck
Branch: MAIN
Changes since 1.28: +4 -2 lines
Diff to previous 1.28 (colored)

fix strlcpy abuse in pax - this commit turns potential overflows into
potential non-spec compliance - the use of these fields as strings needs
to be revisited more thouroughly.
ok millert@ otto@

Revision 1.28 / (download) - annotate - [select for diffs], Fri Jun 11 03:10:43 2004 UTC (20 years ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7, OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.27: +4 -4 lines
Diff to previous 1.27 (colored)

Correct the code that identifies bogus regexps; Jared Yanovich

Revision 1.27 / (download) - annotate - [select for diffs], Fri Jun 11 03:05:01 2004 UTC (20 years ago) by millert
Branch: MAIN
Changes since 1.26: +4 -3 lines
Diff to previous 1.26 (colored)

Fix backref substitution in -s mode.  Problem found and fix verified
by Jared Yanovich.

Revision 1.26 / (download) - annotate - [select for diffs], Fri Apr 16 22:50:23 2004 UTC (20 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.25: +3 -3 lines
Diff to previous 1.25 (colored)

spacing

Revision 1.25 / (download) - annotate - [select for diffs], Mon Jun 2 23:32:08 2003 UTC (21 years ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5, OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.24: +3 -7 lines
Diff to previous 1.24 (colored)

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999.  Proofed by myself and Theo.

Revision 1.24 / (download) - annotate - [select for diffs], Mon Feb 3 09:06:43 2003 UTC (21 years, 4 months ago) by jmc
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3
Changes since 1.23: +5 -5 lines
Diff to previous 1.23 (colored)

typos;
from netbsd(svs+pr@grep.ru)
suggested by deraadt@

Revision 1.23 / (download) - annotate - [select for diffs], Fri Nov 29 20:15:43 2002 UTC (21 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.22: +3 -3 lines
Diff to previous 1.22 (colored)

inconsistant spelling; torh@bogus.net

Revision 1.22 / (download) - annotate - [select for diffs], Wed Oct 16 19:20:02 2002 UTC (21 years, 7 months ago) by millert
Branch: MAIN
Changes since 1.21: +3 -3 lines
Diff to previous 1.21 (colored)

sprinkle const; mostly from NetBSD

Revision 1.21 / (download) - annotate - [select for diffs], Wed Oct 16 17:43:10 2002 UTC (21 years, 7 months ago) by millert
Branch: MAIN
Changes since 1.20: +46 -46 lines
Diff to previous 1.20 (colored)

kill register

Revision 1.20 / (download) - annotate - [select for diffs], Wed Jul 17 18:33:27 2002 UTC (21 years, 10 months ago) by naddy
Branch: MAIN
CVS Tags: OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.19: +8 -7 lines
Diff to previous 1.19 (colored)

Pass the size of the name buffer to rep_name() for use with strlcpy().
Fixes truncation of replacement string.
ok millert@

Revision 1.19 / (download) - annotate - [select for diffs], Sun Jun 9 18:39:48 2002 UTC (22 years ago) by itojun
Branch: MAIN
Changes since 1.18: +3 -3 lines
Diff to previous 1.18 (colored)

revert one of wrong strlcpy() change

Revision 1.18 / (download) - annotate - [select for diffs], Sun Jun 9 02:35:27 2002 UTC (22 years ago) by itojun
Branch: MAIN
Changes since 1.17: +4 -4 lines
Diff to previous 1.17 (colored)

strlcpy fix, PR 2727

Revision 1.17 / (download) - annotate - [select for diffs], Tue Feb 19 19:39:35 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.16: +2 -95 lines
Diff to previous 1.16 (colored)

We live in an ANSI C world.  Remove lots of gratuitous #ifdef __STDC__ cruft.

Revision 1.16 / (download) - annotate - [select for diffs], Sat Feb 16 21:27:07 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
Changes since 1.15: +8 -8 lines
Diff to previous 1.15 (colored)

Part one of userland __P removal.  Done with a simple regexp with some minor hand editing to make comments line up correctly.  Another pass is forthcoming that handles the cases that could not be done automatically.

Revision 1.15 / (download) - annotate - [select for diffs], Wed Jul 4 22:34:17 2001 UTC (22 years, 11 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.14: +19 -3 lines
Diff to previous 1.14 (colored)

Eat backslashes in regex's so things like:
-s '/\/bin\/cat/\/bin\/dog/'
work.  This means we have to be a bit more clever in finding the pattern
delimeters (ie: not strchr).

Revision 1.14 / (download) - annotate - [select for diffs], Wed Jul 4 21:59:53 2001 UTC (22 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.13: +8 -7 lines
Diff to previous 1.13 (colored)

Fix -s option, which never worked.  We need to pass in the input string
to resub() so we can copy the non-matching portion of the string to the
destination.  Closes PR #1889

Revision 1.13 / (download) - annotate - [select for diffs], Sat May 26 00:32:21 2001 UTC (23 years ago) by millert
Branch: MAIN
Changes since 1.12: +2 -101 lines
Diff to previous 1.12 (colored)

Get rid of NET2_FTS and NET2_REGEX #ifdefs since they are useless.
Change NET2_STAT into LONG_OFF_T for portability to systems with
a 32bit off_t.

Revision 1.12 / (download) - annotate - [select for diffs], Wed May 16 03:04:57 2001 UTC (23 years, 1 month ago) by mickey
Branch: MAIN
Changes since 1.11: +25 -29 lines
Diff to previous 1.11 (colored)

use proper str*cpy functions instead of home grown one, spaces; millert@ ok

Revision 1.11 / (download) - annotate - [select for diffs], Mon Sep 1 18:29:56 1997 UTC (26 years, 9 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE, OPENBSD_2_9, OPENBSD_2_8_BASE, OPENBSD_2_8, OPENBSD_2_7_BASE, OPENBSD_2_7, OPENBSD_2_6_BASE, OPENBSD_2_6, OPENBSD_2_5_BASE, OPENBSD_2_5, OPENBSD_2_4_BASE, OPENBSD_2_4, OPENBSD_2_3_BASE, OPENBSD_2_3, OPENBSD_2_2_BASE, OPENBSD_2_2
Changes since 1.10: +8 -8 lines
Diff to previous 1.10 (colored)

i am bored enough to fix terminal space/tab uglies

Revision 1.10 / (download) - annotate - [select for diffs], Fri Jul 25 18:58:34 1997 UTC (26 years, 10 months ago) by mickey
Branch: MAIN
Changes since 1.9: +15 -15 lines
Diff to previous 1.9 (colored)

#if __STDC__ --> #ifdef __STDC__

Revision 1.9 / (download) - annotate - [select for diffs], Wed Jun 4 00:15:17 1997 UTC (27 years ago) by millert
Branch: MAIN
Changes since 1.8: +5 -5 lines
Diff to previous 1.8 (colored)

Fix usage of l_strncpy() (noticed by Theo) and make l_strncpy()
pad with NULL's like strncpy(3).  This eliminates the need for
zf_strncpy(); ocurrences of zf_strncpy() have been changed to l_strncpy().

Revision 1.8 / (download) - annotate - [select for diffs], Sat Apr 5 22:36:15 1997 UTC (27 years, 2 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_1_BASE, OPENBSD_2_1
Changes since 1.7: +34 -2 lines
Diff to previous 1.7 (colored)

Strip leading '/' of pathnames (only in tar mode).  -S option turns
this off like GNU tar.

Revision 1.7 / (download) - annotate - [select for diffs], Sun Mar 30 08:28:10 1997 UTC (27 years, 2 months ago) by millert
Branch: MAIN
Changes since 1.6: +3 -3 lines
Diff to previous 1.6 (colored)

Adjust the input string by the right amount if the pattern wasn't at the
beginning.  From NetBSD (mycroft).

Revision 1.6 / (download) - annotate - [select for diffs], Thu Feb 27 23:32:59 1997 UTC (27 years, 3 months ago) by michaels
Branch: MAIN
Changes since 1.5: +5 -14 lines
Diff to previous 1.5 (colored)

fix pr system/124, reported by Janjaap van Velthooven (janjaap@stack.nl).

Revision 1.5 / (download) - annotate - [select for diffs], Sun Oct 27 06:45:12 1996 UTC (27 years, 7 months ago) by downsj
Branch: MAIN
Changes since 1.4: +17 -4 lines
Diff to previous 1.4 (colored)

Initial cut -C support in paxtar.  Exceeds GNU tar by quite a bit.
General pax still seems to work ok.

Revision 1.4 / (download) - annotate - [select for diffs], Tue Aug 27 03:53:16 1996 UTC (27 years, 9 months ago) by tholo
Branch: MAIN
CVS Tags: OPENBSD_2_0_BASE, OPENBSD_2_0
Changes since 1.3: +4 -2 lines
Diff to previous 1.3 (colored)

Fix uses of strncpy

Revision 1.3 / (download) - annotate - [select for diffs], Sun Jun 23 14:20:38 1996 UTC (27 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.2: +2 -1 lines
Diff to previous 1.2 (colored)

update rcsid

Revision 1.2 / (download) - annotate - [select for diffs], Tue Jun 11 06:41:52 1996 UTC (28 years ago) by tholo
Branch: MAIN
Changes since 1.1: +15 -16 lines
Diff to previous 1.1 (colored)

Correct compile warnings
Rename warn() to paxwarn() so <err.h> can be included

Remove #include <ctype.h> when not needed; from FreeBSD

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Wed Oct 18 08:37:17 1995 UTC (28 years, 7 months ago) by deraadt
CVS Tags: netbsd_1_1
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)

initial import of NetBSD tree

Revision 1.1 / (download) - annotate - [select for diffs], Wed Oct 18 08:37:17 1995 UTC (28 years, 7 months ago) by deraadt
Branch: MAIN

Initial revision

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.