diff options
author | jhb <jhb@FreeBSD.org> | 2009-03-10 21:27:15 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2009-03-10 21:27:15 +0000 |
commit | c8dd604fc285becb2d24a1dde02258f37a6844ff (patch) | |
tree | e70032e419a0840b59ea0c21dd1887b21d4109be /sys | |
parent | e7929cb0bc47aea1300e6e2d199278d734740595 (diff) | |
download | FreeBSD-src-c8dd604fc285becb2d24a1dde02258f37a6844ff.zip FreeBSD-src-c8dd604fc285becb2d24a1dde02258f37a6844ff.tar.gz |
In the ABI shim for vfs.bufspace, rather than truncating values larger than
INT_MAX to INT_MAX, just go ahead and write out the full long to give an
error of ENOMEM to the user process.
Requested by: bde
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/vfs_bio.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 9942934..14c3569 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -287,7 +287,10 @@ sysctl_bufspace(SYSCTL_HANDLER_ARGS) if (sizeof(int) == sizeof(long) || req->oldlen == sizeof(long)) return (sysctl_handle_long(oidp, arg1, arg2, req)); lvalue = *(long *)arg1; - ivalue = lvalue > INT_MAX ? INT_MAX : lvalue; + if (lvalue > INT_MAX) + /* On overflow, still write out a long to trigger ENOMEM. */ + return (sysctl_handle_long(oidp, &lvalue, 0, req)); + ivalue = lvalue; return (sysctl_handle_int(oidp, &ivalue, 0, req)); } #endif |