Don't allow reads past the end of a file.

Submitted by: John Wehle, Andriy Gapon
MFC After: 3 days
This commit is contained in:
Scott Long 2005-01-12 06:17:01 +00:00
parent 972d9bed42
commit d1022c068e

View File

@ -412,7 +412,7 @@ udf_read(struct vop_read_args *a)
while (uio->uio_offset < fsize && uio->uio_resid > 0) {
offset = uio->uio_offset;
size = uio->uio_resid;
size = min (uio->uio_resid, fsize - uio->uio_offset);
error = udf_readatoffset(node, &size, offset, &bp, &data);
if (error == 0)
error = uiomove(data, size, uio);