diff options
author | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2009-12-10 23:50:03 +0000 |
---|---|---|
committer | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2009-12-10 23:50:03 +0000 |
commit | 5bb8bfea4399117c6ec42a58991e48e9e748a62b (patch) | |
tree | 15d51c1440e476d629801cb36ff1c43d40b660e1 /plugin/auth-pam/auth-pam.c | |
parent | Version 2.1_rc22 (diff) | |
download | openvpn-5bb8bfea4399117c6ec42a58991e48e9e748a62b.tar.xz |
Fixed a couple issues in sample plugins auth-pam.c and down-root.c:
1. Fail gracefully rather than segfault if calloc returns NULL.
2. The openvpn_plugin_abort_v1 function can potentially be called
with handle == NULL. Add code to detect this case, and if
so, avoid dereferencing pointers derived from handle.
(Thanks to David Sommerseth for finding this bug).
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@5261 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'plugin/auth-pam/auth-pam.c')
-rw-r--r-- | plugin/auth-pam/auth-pam.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/plugin/auth-pam/auth-pam.c b/plugin/auth-pam/auth-pam.c index 52c62db..b029f85 100644 --- a/plugin/auth-pam/auth-pam.c +++ b/plugin/auth-pam/auth-pam.c @@ -305,6 +305,8 @@ openvpn_plugin_open_v1 (unsigned int *type_mask, const char *argv[], const char * Allocate our context */ context = (struct auth_pam_context *) calloc (1, sizeof (struct auth_pam_context)); + if (!context) + goto error; context->foreground_fd = -1; /* @@ -492,7 +494,7 @@ openvpn_plugin_abort_v1 (openvpn_plugin_handle_t handle) struct auth_pam_context *context = (struct auth_pam_context *) handle; /* tell background process to exit */ - if (context->foreground_fd >= 0) + if (context && context->foreground_fd >= 0) { send_control (context->foreground_fd, COMMAND_EXIT); close (context->foreground_fd); |