[PATCH 2/2] pam_winbind: fix segfault in pam_sm_authenticate()

David Disseldorp ddiss at suse.de
Mon Nov 14 09:31:54 MST 2011


Ensure the potentially null winbind context is not dereferenced on
cleanup.

https://bugzilla.samba.org/show_bug.cgi?id=8564
---
 nsswitch/pam_winbind.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/nsswitch/pam_winbind.c b/nsswitch/pam_winbind.c
index 0497726..cb119a6 100644
--- a/nsswitch/pam_winbind.c
+++ b/nsswitch/pam_winbind.c
@@ -2733,9 +2733,10 @@ out:
 		_pam_free_data_info3(pamh);
 	}
 
-	_PAM_LOG_FUNCTION_LEAVE("pam_sm_authenticate", ctx, retval);
-
-	TALLOC_FREE(ctx);
+	if (ctx != NULL) {
+		_PAM_LOG_FUNCTION_LEAVE("pam_sm_authenticate", ctx, retval);
+		TALLOC_FREE(ctx);
+	}
 
 	return retval;
 }
-- 
1.7.1



More information about the samba-technical mailing list