Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Sep 2004 12:21:46 +0200
From:      gerarra@tin.it
To:        freebsd-hackers@freebsd.org
Subject:   Re: FreeBSD Kernel buffer overflow
Message-ID:  <4146316C0000A1E3@ims3a.cp.tin.it>
In-Reply-To: <20040918090227.GX30151@darkness.comp.waw.pl>

next in thread | previous in thread | raw e-mail | index | archive | help

>-- Messaggio originale --
>Date: Sat, 18 Sep 2004 11:02:27 +0200
>From: Pawel Jakub Dawidek <pjd@FreeBSD.org>
>To: Giorgos Keramidas <keramida@freebsd.org>
>Cc: freebsd-hackers@freebsd.org
>Cc: gerarra@tin.it
>Subject: Re: FreeBSD Kernel buffer overflow
>
>
>On Fri, Sep 17, 2004 at 12:37:12PM +0300, Giorgos Keramidas wrote:
>+> % +#ifdef INVARIANTS
>+> % +       KASSERT(0 <=3D narg && narg <=3D 8, ("invalid number of sys=
call
>args"));
>+> % +#endif
>
>Maybe:
>KASSERT(0 <=3D narg && narg <=3D sizeof(args) / sizeof(args[0]),
>    ("invalid number of syscall args"));
>
>So if we decide to increase/decrease it someday, we don't have to rememb=
er
>about this KASSERT().

Maybe better:

#define ARGS_MAGIC   8

...

int args[ARGS_MAGIC];
....

#ifdef INVARIANTS
KASSERT(0 <=3D narg && narg <=3D ARGS_MAGIC, ("invalid number of syscall =
args"));
#endif

(preprocession work)


rookie






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4146316C0000A1E3>