aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacques Vidrine <nectar@FreeBSD.org>2003-08-10 23:35:21 +0000
committerJacques Vidrine <nectar@FreeBSD.org>2003-08-10 23:35:21 +0000
commit5282423a4af2d919f0b6bb1f63bdf9db9c8b9fc8 (patch)
treef1fde17f09a9ad344a9ca5641fccc6c9c5483b23
parent8daec3f7eade840f068945158d6276921291fe4c (diff)
downloadsrc-5282423a4af2d919f0b6bb1f63bdf9db9c8b9fc8.tar.gz
src-5282423a4af2d919f0b6bb1f63bdf9db9c8b9fc8.zip
MFC 1.24: Validate the iBCS2 statfs(2) length parameter.
Notes
Notes: svn path=/stable/3/; revision=118755
-rw-r--r--sys/i386/ibcs2/ibcs2_stat.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/i386/ibcs2/ibcs2_stat.c b/sys/i386/ibcs2/ibcs2_stat.c
index d3bf6ae077d2..55fa8d5601b8 100644
--- a/sys/i386/ibcs2/ibcs2_stat.c
+++ b/sys/i386/ibcs2/ibcs2_stat.c
@@ -25,6 +25,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+static const char rcsid[] =
+"$FreeBSD$";
#include <sys/param.h>
#include <sys/systm.h>
@@ -78,6 +80,10 @@ cvt_statfs(sp, buf, len)
{
struct ibcs2_statfs ssfs;
+ if (len < 0)
+ return (EINVAL);
+ else if (len > sizeof(ssfs))
+ len = sizeof(ssfs);
bzero(&ssfs, sizeof ssfs);
ssfs.f_fstyp = 0;
ssfs.f_bsize = sp->f_bsize;