summaryrefslogtreecommitdiffstats
path: root/usr.bin/patch (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Change all tame callers to namechange to pledge(2).deraadt2015-10-091-3/+3
|
* patch(1) can move to "stdio rpath wpath cpath tmppath fattr proc exec"deraadt2015-10-071-2/+2
| | | | | | | | | | | | | (adding proc exec), now that "exec" has arrived in the kernel. This permits the dangerous game of feeding ed-style diffs with popen() via /bin/ed. Shocked yet? Your mission, should you choose to accept it, is to replace this code with an builtin ed-style patcher, maybe cribbing code from ed itself. I'm sorry, but we can't fix the entire world all at once. Noone loves deprecating standarized features as much as we do, but there are some lines. Maybe if people become aware of how crappy the implimentations of some standard features are, they could help decide the path.
* remove tame "proc". it is not useful, because the "ed" diffs requirederaadt2015-10-041-2/+2
| | | | | | fork+execve, and execve is not going to become available in this fashion. ed diffs should be handled using a built-in handler, and various folks have been discussing this behind the scenes.
* As pointed out by tobiasu, ed-style patches still use popen() and executederaadt2015-10-031-2/+2
| | | | | | | | | /bin/ed. This is RETARDED. Nothing learned from the last year? Add tame "proc" until that is fixed, to allow fork+exec. I beg for someone to cross-link the guts of ed directly into patch, or write a ed-subset which can do the job.
* patch appears to work fully with tame "stdio rpath wpath cpath tmppath fattr".deraadt2015-10-031-1/+4
| | | | | | in case of exploitation, no more network access, fork, execve, etc. I wonder if we could use whitepath lists here - if it is reasonable to limit operation in directories known early on?
* Account for newlines in substitution (s///) commands. Substitutionmillert2015-07-311-2/+14
| | | | | | | | commands might contain a newline in the replacement pattern (escaped with a backslash before it), causing patch's understanding of the state the ed child process is in to diverge from reality. This can lead to patch unwillingly feeding '!' (execute shell command) lines to ed. From Martin Natano. OK deraadt@
* Remove support for automatically checking files out of RCS. Themillert2015-07-266-133/+20
| | | | | behavior is confusing to users and even GNU patch no longer does it by default. OK krw@ guenther@
* remove the first comma from constructs like ", and," and ", or,": you can usejmc2015-03-131-3/+3
| | | | | "and" and "or" to join sentence clauses, and you can use commas, but both hinders reading;
* Include stdint.h, not limits.h to get SIZE_MAX. OK guenther@millert2015-02-052-3/+4
|
* Replace <sys/param.h> with <limits.h> and other less dirty headers wherederaadt2015-01-161-4/+3
| | | | | | | | | possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
* Handle ed command "s" as a one line command, which it is.tobias2014-12-141-3/+3
| | | | | | Prevents arbitrary ed command executions in following lines. ok millert
* The function savestr allows NULL return values during Plan A patching so intobias2014-12-134-17/+34
| | | | | | case of out of memory conditions, Plan B can step in. In many cases, NULL value is not properly handled, so use xstrdup here (it's outside Plan A/B patching, which means that even Plan B relies on successful operations).
* Fix division by zero for files with long lines (> 1024) in Plan B modetobias2014-12-091-19/+37
| | | | | | by supporting arbitrarily long lines just like Plan A does. ok tedu
* spacesderaadt2014-12-082-5/+5
|
* three trivial reallocarray() usesderaadt2014-12-011-4/+4
|
* Prefer setvbuf() to setlinebuf() for portability; ok deraadt@millert2014-11-261-3/+3
|
* Properly validate line ranges supplied in diff file to prevent overflows.tobias2014-11-261-4/+27
| | | | | | | Also fixes an out of boundary memory access because the resulting values are used as array indices. ok millert
* Introduce strtolinenum to properly check line numbers while parsing:tobias2014-11-252-33/+51
| | | | | | no signs, no spaces, just digits, 0 <= x <= LONG_MAX ok millert, otto
* Prevent null pointer dereference on empty input files when diff requirestobias2014-11-251-2/+2
| | | | | | a specific version. ok millert
* Remove SCCS support. For this to work, we would need "get", which we don'ttobias2014-11-225-23/+12
| | | | | | even have in ports. XSI functionality of POSIX, therefore optional. ok deraadt, schwarze, tedu
* Remove the README. It history from more than 20 years ago, and whilederaadt2014-11-211-123/+0
| | | | | interesting it has no impact on the maintainance of this stuff. ok tobias
* Avoid iterating over end of string.tobias2014-11-181-3/+3
| | | | ok millert, otto
* Check fstat return value. Also, use off_t for file size and offsets astobias2014-11-171-37/+39
| | | | | | suggested by bluhm@. ok schwarze@
* Call munmap with the same size argument as mmap.tobias2014-11-151-2/+2
| | | | ok millert, otto
* userland reallocarray audit.doug2014-10-081-2/+2
| | | | | | | Replace malloc() and realloc() calls that may have integer overflow in the multiplication of the size argument with reallocarray(). ok deraadt@
* Use errc/warnc to simplify code.guenther2014-05-201-2/+2
| | | | | | Also, in 'ftp', always put the error message last, after the hostname/ipaddr. ok jsing@ krw@ millert@
* patch was moved from user portability (UP) to base in issue 7jmc2014-04-151-8/+5
| | | | and is no longer optional;
* unsigned char casts for ctypederaadt2013-11-265-44/+49
| | | | ok krw
* pull in local .h files to satisfy protoderaadt2013-11-121-1/+4
|
* Bring file selection in accordance with the man page; from Stefan Esserotto2013-07-111-35/+33
| | | | ok millert@
* Fix confusing patch(1) output on failure when using -C. Frommillert2012-05-151-8/+7
| | | | dragonflybsd via Loganaden Velvindron. OK mikeb@ and deraadt@
* Silence gcc warnings.ajacoutot2012-04-111-1/+3
| | | | ok deraadt@
* Don't try to mmap a zero length file, from NetBSD.ajacoutot2012-04-101-6/+10
| | | | | | Needed after the recent mmap(2) change. ok ariane@
* add an EXIT STATUS section for /usr/bin;jmc2010-09-031-18/+18
|
* Send normal output to stdout instead of everything to stderr. Thisray2010-07-242-8/+6
| | | | | | | | | | is currently done in the latest versions of GNU patch. Please watch out for output appearing out-of-order. Discussed with millert and deraadt. OK deraadt
* Don't leak memory after strdup() in makedirs().oga2010-01-081-2/+4
| | | | | | From Igor Zinovik; thanks! ok stsp@, millert@
* rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andderaadt2009-10-275-25/+5
| | | | | | | 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
* If no patch can be found in input, in addition to complaining on stderr,stsp2009-04-051-2/+10
| | | | | | | | have the exit code indicate failure, not success. Discrepancy with GNU patch pointed out by Arfrever Frehtes Taifersar Arahesis. Help from and ok djm@, "sounds good to me" millert@
* updates to IEEE Std 1003.1-2008;jmc2009-02-081-2/+2
|
* bump the posix reference in STANDARDS to IEEE Std 1003.1-2008, with a fewjmc2009-02-081-5/+5
| | | | updates to follow;
* over-rule -> overrule; from Thomas Pfaffjmc2008-10-191-3/+3
|
* The code to detect multiple applied diffs to empty files I introduced 4otto2008-08-201-9/+3
| | | | | | years ago is not correct if the diff has an empty context for other reasons, so revert that change. Problem found by Joerg Sonnenberger; ok tedu@ millert@
* update the description of -b and STANDARDS; suggested by grunkjmc2008-06-061-7/+14
| | | | ok millert
* providing MLINKS for shell builtins makes little sense: what we had was outjmc2008-01-111-5/+4
| | | | | | | | | | | of date for ever (no ksh builtins), and since we have two shells, pointing to one page or the other is never going to work; so remove MLINKS for csh(1); the cd(1) and wait(1) pages (also builtins); and update any trailing Xr's; please, there are tools like whence, man, and locate for finding this stuff; ok deraadt miod
* use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsgderaadt2007-09-021-5/+5
|
* convert to new .Dd format;jmc2007-05-311-2/+2
|
* - note some apps which are xpg4, not posixjmc2007-05-311-1/+14
| | | | | | - note that some apps are optional to posix after some discussion w/ otto
* adds a detailed synopsis to the man page; sorts options insobrado2007-04-182-57/+96
| | | | | | | | the description list and adds missing arguments; syncs usage() written with a lot of useful advice by jmc@ ok by jmc@
* type police and assorted cleanup. From Lionel Fourquaux; ok ray@otto2006-03-116-24/+27
|
* constuct -> constructmiod2005-11-141-3/+3
|