Skip to content

Commit 27c5907

Browse files
committed
Guard against NULL remote credentials
In some rare cases is may happen that we fail to init cred_handle->remote, in this case we need to guard xdr_free() because this function does not handle NULL pointers gracefully like free() does. Signed-off-by: Simo Sorce <simo@redhat.com>
1 parent 5411fda commit 27c5907

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/mechglue/gpp_init_sec_context.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,11 @@ OM_uint32 gssi_init_sec_context(OM_uint32 *minor_status,
171171
&out_cred);
172172
if (maj == GSS_S_COMPLETE || maj == GSS_S_CONTINUE_NEEDED) {
173173
if (out_cred) {
174-
xdr_free((xdrproc_t)xdr_gssx_cred,
175-
(char *)cred_handle->remote);
176-
free(cred_handle->remote);
174+
if (cred_handle->remote) {
175+
xdr_free((xdrproc_t)xdr_gssx_cred,
176+
(char *)cred_handle->remote);
177+
free(cred_handle->remote);
178+
}
177179
cred_handle->remote = out_cred;
178180
out_cred = NULL;
179181
/* failuire is not fatal */

0 commit comments

Comments
 (0)