1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

Merge branch 'dub-the-wub' into 'master'

Prevent a memory leak during the processing of the SASL response.

See merge request !8
This commit is contained in:
Nei 2017-02-03 11:49:16 +00:00 committed by ailin-nemui
parent ca5e9bd623
commit 97b182089e

View File

@ -174,10 +174,16 @@ static gboolean sasl_reassemble_incoming(IRC_SERVER_REC *server, const char *fra
*decoded = g_string_new_len("", 0); *decoded = g_string_new_len("", 0);
} else { } else {
gsize dec_len; gsize dec_len;
gchar *tmp; gint state = 0;
guint save = 0;
tmp = (gchar *) g_base64_decode(enc_req->str, &dec_len); /* Since we're not going to use the enc_req GString anymore we
*decoded = g_string_new_len(tmp, dec_len); * can perform the decoding in place. */
dec_len = g_base64_decode_step(enc_req->str, enc_req->len,
(guchar *)enc_req->str,
&state, &save);
/* A copy of the data is made when the GString is created. */
*decoded = g_string_new_len(enc_req->str, dec_len);
} }
g_string_free(enc_req, TRUE); g_string_free(enc_req, TRUE);