* 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:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user