Remove useless comparisions of assigned offset and resid with the
sources from uio. Both uio_offset and offset, and uio_resid and resid have the same types for some time. Add check for buflen overflow by comparing the buflen with both offset and resid (vs. comparing with offset only, as it is currently done). Reported and tested by: pho Approved by: des (pseudofs maintainer) Sponsored by: The FreeBSD Foundation MFC after: 1 week
This commit is contained in:
parent
d8efce3921
commit
5ba4de79a7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=258088
@ -654,11 +654,13 @@ pfs_read(struct vop_read_args *va)
|
||||
goto ret;
|
||||
}
|
||||
|
||||
resid = uio->uio_resid;
|
||||
offset = uio->uio_offset;
|
||||
buflen = offset + resid;
|
||||
|
||||
/* beaucoup sanity checks so we don't ask for bogus allocation */
|
||||
if (uio->uio_offset < 0 || uio->uio_resid < 0 ||
|
||||
(offset = uio->uio_offset) != uio->uio_offset ||
|
||||
(resid = uio->uio_resid) != uio->uio_resid ||
|
||||
(buflen = offset + resid) < offset || buflen >= INT_MAX) {
|
||||
if (resid < 0 || buflen < offset || buflen < resid ||
|
||||
buflen >= INT_MAX) {
|
||||
error = EINVAL;
|
||||
goto ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user