diff options
author | Christopher Faylor <me@cgf.cx> | 2001-10-20 05:08:21 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2001-10-20 05:08:21 +0000 |
commit | 6fdd213161e7795b55ac1c0a4f70d02d13f53f82 (patch) | |
tree | 5c1a107449d272712c0904114c9ac0181bfac07c /winsup/cygwin/miscfuncs.cc | |
parent | 5318c4983306850bffa748b4feaa87f7c6d666bb (diff) | |
download | cygnal-6fdd213161e7795b55ac1c0a4f70d02d13f53f82.tar.gz cygnal-6fdd213161e7795b55ac1c0a4f70d02d13f53f82.tar.bz2 cygnal-6fdd213161e7795b55ac1c0a4f70d02d13f53f82.zip |
* 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.
Diffstat (limited to 'winsup/cygwin/miscfuncs.cc')
-rw-r--r-- | winsup/cygwin/miscfuncs.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc index c5d46fbf0..63b05d975 100644 --- a/winsup/cygwin/miscfuncs.cc +++ b/winsup/cygwin/miscfuncs.cc @@ -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; +} |