Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:GA
pam_ldap
pam_ldap-fix-leaks.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File pam_ldap-fix-leaks.patch of Package pam_ldap
From 2017376ac0adbcbadc386737980ebb71ae28e929 Mon Sep 17 00:00:00 2001 From: Biplab Sarkar <biplab.sarkar@nokia.com> Date: Fri, 29 Nov 2019 14:39:49 +0530 Subject: [PATCH] fixed memory leaks Update: Fix segfault in pam_sm_chauthtok(). Signed-off-by: Josef Cejka <jcejka@suse.com> --- pam_ldap.c | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) Index: pam_ldap-186/pam_ldap.c =================================================================== --- pam_ldap-186.orig/pam_ldap.c +++ pam_ldap-186/pam_ldap.c @@ -142,6 +142,8 @@ #define ldap_memfree(x) free(x) #endif +#define FREE_IF(x) if(x != NULL){free(x); x = NULL;} + #ifdef __GNUC__ #define __UNUSED__ __attribute__ ((unused)) #else @@ -517,7 +519,21 @@ _release_config (pam_ldap_config_t ** pc { free (c->password_prohibit_message); } - + if (c->ssd != NULL) + { + /* + This is a linked list. + */ + pam_ssd_t *p_ssd = c->ssd; + while(p_ssd != NULL) + { + pam_ssd_t *p_ssd_next = p_ssd->next; + FREE_IF(p_ssd->base); + FREE_IF(p_ssd->filter); + FREE_IF(p_ssd); + p_ssd = p_ssd_next; + }; + } memset (c, 0, sizeof (*c)); free (c); *pconfig = NULL; @@ -3338,7 +3354,7 @@ static int _get_authtok (pam_handle_t * pamh, int flags, int first) { int rc; - char *p; + char *p = NULL; struct pam_message msg[1], *pmsg[1]; struct pam_response *resp; struct pam_conv *conv; @@ -3379,7 +3395,7 @@ _get_authtok (pam_handle_t * pamh, int f free (resp); pam_set_item (pamh, PAM_AUTHTOK, p); - + FREE_IF(p); return PAM_SUCCESS; } @@ -3399,9 +3415,14 @@ _conv_sendmsg (struct pam_conv *aconv, msg.msg = (char *) message; resp = NULL; - return aconv->conv (1, + int ret = aconv->conv (1, (CONST_ARG struct pam_message **) &pmsg, &resp, aconv->appdata_ptr); + if (resp != NULL) { + FREE_IF(resp->resp); + FREE_IF(resp); + } + return (ret); } PAM_EXTERN int
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor