HomeFreeBSD

MFC r275553, r275612;

Description

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

Details

Provenance
pfgAuthored on
Parents
rS275840: MFC r275531, r275581, r275582;
Branches
Unknown
Tags
Unknown

Event Timeline