diff options
author | pfg <pfg@FreeBSD.org> | 2014-12-16 21:13:55 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2014-12-16 21:13:55 +0000 |
commit | 7cc43d5ff85217e4aff8929e976bc2a175891fca (patch) | |
tree | 81f2eb8263c48b2958f82750aaa512405ef82c64 /usr.bin/patch/common.h | |
parent | 8631101d5aaad1393a949c1725cee5710626c49f (diff) | |
download | FreeBSD-src-7cc43d5ff85217e4aff8929e976bc2a175891fca.zip FreeBSD-src-7cc43d5ff85217e4aff8929e976bc2a175891fca.tar.gz |
MFC r275553, r275612;
patch(1): Bring fixes from OpenBSD
Check fstat return value. Use off_t for file size and offsets.
Avoid iterating over end of string.
Introduce strtolinenum to properly check line numbers while parsing:
no signs, no spaces, just digits, 0 <= x <= LONG_MAX
Properly validate line ranges supplied in diff file to prevent overflows.
Also fixes an out of boundary memory access because the resulting values
are used as array indices.
PR: 195436
Obtained from: OpenBSD
Diffstat (limited to 'usr.bin/patch/common.h')
-rw-r--r-- | usr.bin/patch/common.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/usr.bin/patch/common.h b/usr.bin/patch/common.h index a6da179..8963c83 100644 --- a/usr.bin/patch/common.h +++ b/usr.bin/patch/common.h @@ -40,6 +40,7 @@ #define INITHUNKMAX 125 /* initial dynamic allocation size */ #define INITLINELEN 4096 #define BUFFERSIZE 4096 +#define LINENUM_MAX LONG_MAX #define SCCSPREFIX "s." #define GET "get -e %s" |