* miscfuncs.cc (+__check_invalid_read_ptr_errno): New function.

* syscalls.c (_write): Validate that write buffer is accessible for reading,
not writing.
* winsup.h: Declare new function, increase regparmization of check_* functions.
This commit is contained in:
Christopher Faylor
2001-10-20 05:08:21 +00:00
parent 5318c49833
commit 6fdd213161
4 changed files with 21 additions and 3 deletions

View File

@ -153,3 +153,12 @@ __check_null_invalid_struct_errno (const void *s, unsigned sz)
set_errno (__err);
return __err;
}
int __stdcall
__check_invalid_read_ptr_errno (const void *s, unsigned sz)
{
if (!s || IsBadReadPtr ((void *) s, sz))
set_errno (EFAULT);
return 0;
}