From 15aa08eecb11efc5b81426ff8d0a74f829fa943f Mon Sep 17 00:00:00 2001 From: Elly Date: Tue, 1 Jun 2010 13:11:47 -0400 Subject: [PATCH] Fix memory leaks in PASS command, both in normal and repeated use. --- modules/m_pass.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/m_pass.c b/modules/m_pass.c index c331e25f4..0c7636fed 100644 --- a/modules/m_pass.c +++ b/modules/m_pass.c @@ -67,10 +67,17 @@ mr_pass(struct Client *client_p, struct Client *source_p, int parc, const char * memset(client_p->localClient->passwd, 0, strlen(client_p->localClient->passwd)); rb_free(client_p->localClient->passwd); + client_p->localClient->passwd = NULL; + } + + if (client_p->localClient->auth_user) + { + memset(client_p->localClient->auth_user, 0, + strlen(client_p->localClient->auth_user)); + rb_free(client_p->localClient->auth_user); + client_p->localClient->auth_user = NULL; } - client_p->localClient->passwd = rb_strndup(parv[1], PASSWDLEN); - if ((pass = strchr(buf, ':')) != NULL) { *pass++ = '\0';