summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-04-03 14:57:59 -0400
committerSimo Sorce <simo@redhat.com>2013-04-03 16:39:11 -0400
commitca7a49fbefef59fe4839a83077a3abaa995c47d9 (patch)
treeeb688dd304be2eb4808e13905bc667d23ff5be61
parentd3bb4d70f00d429b21e481c7944a1851df14b9a4 (diff)
downloadgss-proxy-ca7a49fbefef59fe4839a83077a3abaa995c47d9.tar.gz
gss-proxy-ca7a49fbefef59fe4839a83077a3abaa995c47d9.tar.xz
gss-proxy-ca7a49fbefef59fe4839a83077a3abaa995c47d9.zip
Fix dereference after null checks found by Coverity
Signed-off-by: Simo Sorce <simo@redhat.com>
-rw-r--r--proxy/src/gp_conv.c7
-rw-r--r--proxy/src/gp_socket.c2
-rw-r--r--proxy/src/mechglue/gpp_acquire_cred.c6
-rw-r--r--proxy/src/mechglue/gpp_context.c4
4 files changed, 13 insertions, 6 deletions
diff --git a/proxy/src/gp_conv.c b/proxy/src/gp_conv.c
index f402ba7..cccfe16 100644
--- a/proxy/src/gp_conv.c
+++ b/proxy/src/gp_conv.c
@@ -300,7 +300,7 @@ int gp_conv_err_to_gssx_string(uint32_t status, int type, gss_OID oid,
ret_maj = gss_display_status(&ret_min,
status, type, oid,
&msg_ctx, &gssbuf);
- if (ret_maj == 0) {
+ if (ret_maj == GSS_S_COMPLETE) {
if (str) {
ret = asprintf(&t, "%s, %s", str, (char *)gssbuf.value);
if (ret == -1) {
@@ -316,9 +316,10 @@ int gp_conv_err_to_gssx_string(uint32_t status, int type, gss_OID oid,
}
}
gss_release_buffer(&ret_min, &gssbuf);
- }
- if (ret_maj) {
+ } else {
ret = EINVAL;
+ }
+ if (ret) {
goto done;
}
} while (msg_ctx);
diff --git a/proxy/src/gp_socket.c b/proxy/src/gp_socket.c
index 8bb71d1..20a13c5 100644
--- a/proxy/src/gp_socket.c
+++ b/proxy/src/gp_socket.c
@@ -75,6 +75,8 @@ struct gp_creds *gp_conn_get_creds(struct gp_conn *conn)
void gp_conn_free(struct gp_conn *conn)
{
+ if (!conn) return;
+
if (conn->us.sd != -1) {
close(conn->us.sd);
}
diff --git a/proxy/src/mechglue/gpp_acquire_cred.c b/proxy/src/mechglue/gpp_acquire_cred.c
index b3a46ec..43eca8c 100644
--- a/proxy/src/mechglue/gpp_acquire_cred.c
+++ b/proxy/src/mechglue/gpp_acquire_cred.c
@@ -256,6 +256,10 @@ OM_uint32 gssi_acquire_cred_with_password(OM_uint32 *minor_status,
GSSI_TRACE();
+ if (desired_name == GSS_C_NO_NAME) {
+ *minor_status = gpp_map_error(EINVAL);
+ return GSS_S_BAD_NAME;
+ }
name = (struct gpp_name_handle *)desired_name;
if (!output_cred_handle) {
@@ -289,7 +293,7 @@ OM_uint32 gssi_acquire_cred_with_password(OM_uint32 *minor_status,
goto done;
}
- if (name && name->remote && !name->local) {
+ if (name->remote && !name->local) {
maj = gpp_name_to_local(&min, name->remote,
name->mech_type, &name->local);
if (maj) {
diff --git a/proxy/src/mechglue/gpp_context.c b/proxy/src/mechglue/gpp_context.c
index 90dc897..448c3e0 100644
--- a/proxy/src/mechglue/gpp_context.c
+++ b/proxy/src/mechglue/gpp_context.c
@@ -320,8 +320,8 @@ OM_uint32 gssi_set_sec_context_option(OM_uint32 *minor_status,
GSSI_TRACE();
- if (context_handle) {
- ctx = (struct gpp_context_handle *)context_handle;
+ if (*context_handle) {
+ ctx = (struct gpp_context_handle *)(*context_handle);
} else {
ctx = calloc(1, sizeof(struct gpp_context_handle));
if (!ctx) {