1
0
mirror of https://github.com/irssi/irssi.git synced 2024-10-27 05:20:20 -04:00

Merge pull request #525 from ailin-nemui/issue522

fix use after free in expando error
This commit is contained in:
ailin-nemui 2016-08-14 23:35:23 +02:00 committed by GitHub
commit c284309d36

View File

@ -74,15 +74,18 @@ static char *perl_expando_event(PerlExpando *rec, SERVER_REC *server,
ret = NULL; ret = NULL;
if (SvTRUE(ERRSV)) { if (SvTRUE(ERRSV)) {
PERL_SCRIPT_REC *script = rec->script;
(void) POPs; (void) POPs;
/* call putback before emitting script error signal as that /* call putback before emitting script error signal as that
* could manipulate the perl stack. */ * could manipulate the perl stack. */
PUTBACK; PUTBACK;
/* make sure we don't get back here */ /* make sure we don't get back here */
if (rec->script != NULL) if (script != NULL)
script_unregister_expandos(rec->script); script_unregister_expandos(script);
/* rec has been freed now */
signal_emit("script error", 2, rec->script, SvPV_nolen(ERRSV)); signal_emit("script error", 2, script, SvPV_nolen(ERRSV));
} else if (retcount > 0) { } else if (retcount > 0) {
ret = g_strdup(POPp); ret = g_strdup(POPp);
*free_ret = TRUE; *free_ret = TRUE;