Page MenuHomeFreeBSD

patch(1): Don't overrun line buffer if line is not completely malformed
ClosedPublic

Authored by kevans on Oct 6 2017, 4:39 PM.
Tags
None
Referenced Files
F149841611: D12609.diff
Fri, Mar 27, 12:37 PM
Unknown Object (File)
Sat, Mar 21, 8:23 AM
Unknown Object (File)
Sat, Mar 21, 8:23 AM
Unknown Object (File)
Thu, Mar 19, 6:25 AM
Unknown Object (File)
Thu, Mar 19, 3:14 AM
Unknown Object (File)
Tue, Mar 17, 4:02 AM
Unknown Object (File)
Sat, Mar 7, 11:48 AM
Unknown Object (File)
Feb 8 2026, 5:47 AM
Subscribers

Details

Summary

Patches like file.txt attached to PR 190195 with a final line formed
like ">(EOL)" could cause a copy past the end of the current line buffer. In the
case of PR 191641, this caused a duplicate line to be copied into the resulting
file.

Instead of running past the end, treat it as if it were a blank line.

PR: 191641

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Whoops, it's still possible to run out of memory there, and this looks a little
cleaner

This revision is now accepted and ready to land.Oct 7 2017, 3:36 AM
This revision was automatically updated to reflect the committed changes.