Date: Wed, 11 Sep 2002 18:59:54 +0800 From: Grahame Bowland <grahame@ucs.uwa.edu.au> To: freebsd-hackers@freebsd.org Subject: Checking syscall arguments Message-ID: <200209111859.54919.grahame@ucs.uwa.edu.au>
next in thread | raw e-mail | index | archive | help
Hi all,
When implementing a syscall for FreeBSD, how do you ensure that the arguments
you have been passed are sane? I'm interested in the following syscall:
int setattr(char *file, struct stat *st, unsigned bitmap);
As far as I can see from reading similar functions, such as fhstatfs, the
correct way to do it is:
{
struct stat st;
error = copyin(SCARG(uap, st), &st, sizeof(struct stat));
if (error) { return error; }
}
Does the above code ensure that I'm safe, and I can 'trust' that there is a
struct stat 'st' that I can access normally in the code? Obviously I can't
trust the values contained in it, however can I be assured that I'm not going
to overrun or anything nasty by doing the above?
Cheers,
Grahame
--
Grahame Bowland Email: grahame@ucs.uwa.edu.au
University Communications Services Phone: +61 8 9380 1175
The University of Western Australia Fax: +61 8 9380 1109
CRICOS: 00126G
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209111859.54919.grahame>
