]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r344023:
authorBrooks Davis <brooks@FreeBSD.org>
Mon, 18 Feb 2019 18:44:20 +0000 (18:44 +0000)
committerBrooks Davis <brooks@FreeBSD.org>
Mon, 18 Feb 2019 18:44:20 +0000 (18:44 +0000)
commit246ce0b8599bba900573b70a383e33a2dd759376
tree911b6316fac182041f8d40e64bff12ed72bb1bef
parentdc7696b1d4f03519a7a082a3a63d220130a4d126
MFC r344023:

mdmfs: Fix many bugs in automatic md(4) creation.

This code allocated a correctly sized buffer, read past the end of the
source buffer, writing off the end of the target buffer, and then writing
a '\0' terminator past the end of the target buffer (in the wrong place).
It then leaked the buffer.

Switch to a statically sized buffer on the stack and update the source
pointer and length before use so the correct things are copied.

Fix a logic error in the checks that the format of the line is as
expected and move on out of an assert.

Remove an unneeded close(). fclose() closes the descriptor.

Found with: CheriABI
Obtained from: CheriBSD
Reviewed by: kib, jhb, markj
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D19122
sbin/mdmfs/mdmfs.c