]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
mdmfs: Fix many bugs in automatic md(4) creation.
authorbrooks <brooks@FreeBSD.org>
Mon, 11 Feb 2019 21:31:26 +0000 (21:31 +0000)
committerbrooks <brooks@FreeBSD.org>
Mon, 11 Feb 2019 21:31:26 +0000 (21:31 +0000)
commit3a2450df1c2de2e886159007d74f347b22fa3ebd
tree6deafe75d8971387c278b5852091f6602c98ea84
parent7a00254565eb5099b46b95a3f02f72063683410c
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
Differential Revision: https://reviews.freebsd.org/D19122
sbin/mdmfs/mdmfs.c