sed: Bounds check the file path used in the 'w' command.

Modified version of a diff from Sebastien Marie to prevent a crash found
with the afl fuzzer.

Obtained from:	OpenBSD (CVS Rev. 1.37)
MFC after:	1 week
Add an UPDATING entry and warning about the change in r274807 to help users
transition to the new behavior.

Discussed with:	jmallett
Sponsored by:	DARPA, AFRL
Do not count RCTD bit set as an error.

We can not really implement it, but specification tells that it "shall"
work, so it can be safely ignored.

MFC after:	1 week
Merge remote-tracking branch 'freebsd/master' into hardened/current/master