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: [EMAIL PROTECTED]
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 [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to