From 7a4078ee340b7f15c839257d6fa895d92abe0224 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Thu, 28 Jun 2001 02:19:57 +0000 Subject: Change check_null_empty_path* to check_null_empty_str* throughout. * path.cc (path_conv::check): Add signal protection here since retrieving info about remote shares can take some time. * path.h (check_null_empty_str_errno): Convert to a function prototype. * path.cc (check_null_empty_str): Move to miscfuncs.cc. * miscfuncs.cc (check_null_empty_str_errno): New function. (__check_null_invalid_struct): Ditto. (__check_null_invalid_struct_errno): Ditto. (check_null_empty_str): Change from VirtualQuery to IsBadWritePtr. * thread.cc (check_valid_pointer): Ditto. * resource.cc (getrlimit): Use check_null_invalid_struct macro for checking validity of pointer. (setrlimit): Ditto. --- winsup/cygwin/resource.cc | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'winsup/cygwin/resource.cc') diff --git a/winsup/cygwin/resource.cc b/winsup/cygwin/resource.cc index fbd335ae6..c56fb77fd 100644 --- a/winsup/cygwin/resource.cc +++ b/winsup/cygwin/resource.cc @@ -105,12 +105,8 @@ extern "C" int getrlimit (int resource, struct rlimit *rlp) { - MEMORY_BASIC_INFORMATION m; - if (!rlp || !VirtualQuery (rlp, &m, sizeof (m)) || (m.State != MEM_COMMIT)) - { - set_errno (EFAULT); - return -1; - } + if (check_null_invalid_struct_errno (rlp)) + return -1; rlp->rlim_cur = RLIM_INFINITY; rlp->rlim_max = RLIM_INFINITY; @@ -141,12 +137,8 @@ extern "C" int setrlimit (int resource, const struct rlimit *rlp) { - MEMORY_BASIC_INFORMATION m; - if (!rlp || !VirtualQuery (rlp, &m, sizeof (m)) || (m.State != MEM_COMMIT)) - { - set_errno (EFAULT); - return -1; - } + if (check_null_invalid_struct_errno (rlp)) + return -1; struct rlimit oldlimits; -- cgit v1.2.3