Fix PR/2801: Zero length svr4_mmap() should return EINVAL.

This commit is contained in:
christos 1996-10-07 16:16:14 +00:00
parent ba4d6af5fa
commit 3e00b323f3

View File

@ -1,4 +1,4 @@
/* $NetBSD: svr4_misc.c,v 1.40 1996/09/25 04:37:13 christos Exp $ */
/* $NetBSD: svr4_misc.c,v 1.41 1996/10/07 16:16:14 christos Exp $ */
/*
* Copyright (c) 1994 Christos Zoulas
@ -333,6 +333,9 @@ svr4_sys_mmap(p, v, retval)
if (SCARG(uap, prot) & ~(PROT_READ | PROT_WRITE | PROT_EXEC))
return EINVAL; /* XXX still needed? */
if (SCARG(uap, len) == 0)
return EINVAL;
SCARG(&mm, prot) = SCARG(uap, prot);
SCARG(&mm, len) = SCARG(uap, len);
SCARG(&mm, flags) = SCARG(uap, flags) & ~_MAP_NEW;