diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2003-10-27 11:28:37 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2003-10-27 11:28:37 +0300 |
commit | d845665e0f04feb9a0ef927fce1392568a51f90f (patch) | |
tree | 1f4c97e3eb200f3ace59a43a1a80a9806f5043d5 /winsup | |
parent | db30fe125f32439c108468319c98caaa94dfe7bb (diff) |
* miscfunc.cc (__check_invalid_read_ptr): New function.
* winsup.h: Declare.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/miscfuncs.cc | 8 | ||||
-rw-r--r-- | winsup/cygwin/winsup.h | 1 |
3 files changed, 14 insertions, 0 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 08e7efe79..6223194bb 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2003-10-27 Corinna Vinschen <corinna@vinschen.de> + + * miscfunc.cc (__check_invalid_read_ptr): New function. + * winsup.h: Declare. + 2003-10-26 Corinna Vinschen <corinna@vinschen.de> * security.h (cygpsid::debug_print): Avoid compiler warnings. diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc index d9e4a7adb..be7c8a30e 100644 --- a/winsup/cygwin/miscfuncs.cc +++ b/winsup/cygwin/miscfuncs.cc @@ -199,6 +199,14 @@ __check_null_invalid_struct_errno (void *s, unsigned sz) } int __stdcall +__check_invalid_read_ptr (const void *s, unsigned sz) +{ + if (s && !IsBadReadPtr (s, sz)) + return 0; + return EFAULT; +} + +int __stdcall __check_invalid_read_ptr_errno (const void *s, unsigned sz) { if (s && !IsBadReadPtr (s, sz)) diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h index 745519ea1..305b621db 100644 --- a/winsup/cygwin/winsup.h +++ b/winsup/cygwin/winsup.h @@ -250,6 +250,7 @@ int __stdcall check_null_empty_str_errno (const char *name) __attribute__ ((regp int __stdcall check_null_str_errno (const char *name) __attribute__ ((regparm(1))); int __stdcall __check_null_invalid_struct (void *s, unsigned sz) __attribute__ ((regparm(2))); int __stdcall __check_null_invalid_struct_errno (void *s, unsigned sz) __attribute__ ((regparm(2))); +int __stdcall __check_invalid_read_ptr (const void *s, unsigned sz) __attribute__ ((regparm(2))); int __stdcall __check_invalid_read_ptr_errno (const void *s, unsigned sz) __attribute__ ((regparm(2))); #define check_null_invalid_struct(s) \ |