[Pkg-privacy-commits] [irssi-plugin-otr] 119/267: Fix possible segfaults with missing context

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 12:41:34 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch debian
in repository irssi-plugin-otr.

commit b86ae1626a7cc8ddf3919c03fcc959d8dc3c7881
Author: David Goulet <dgoulet at ev0ke.net>
Date:   Wed Nov 7 23:40:37 2012 -0500

    Fix possible segfaults with missing context
    
    Signed-off-by: David Goulet <dgoulet at ev0ke.net>
---
 src/otr-formats.c |  4 ++--
 src/otr.c         | 11 ++++++++---
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/otr-formats.c b/src/otr-formats.c
index e8127d1..a7ff5fd 100644
--- a/src/otr-formats.c
+++ b/src/otr-formats.c
@@ -81,8 +81,8 @@ FORMAT_REC formats[] = {
 		{ "auth_peer_replied", "%9OTR%9: $0 replied to our auth request...", 1, { 0 }},
 		{ "auth_peer_wrong_smp3", "%9OTR%9: $0 sent a wrong authentication message (SMP3).", 1, { 0 }},
 		{ "auth_peer_wrong_smp4", "%9OTR%9: $0 sent a wrong authentication message (SMP4).", 1, { 0 }},
-		{ "auth_successful", "%9OTR%9: Authentication successful!", 0},
-		{ "auth_failed", "%9OTR%9: Authentication failed!", 0},
+		{ "auth_successful", "%9OTR%9: %GAuthentication successful!%n", 0},
+		{ "auth_failed", "%9OTR%9: %RAuthentication failed!%n", 0},
 		{ "auth_needenc", "%9OTR%9: You need to establish an OTR session before you can authenticate.", 0},
 		{ NULL, "Commands", 0 }
 	,
diff --git a/src/otr.c b/src/otr.c
index 0fa84f4..d96c57b 100644
--- a/src/otr.c
+++ b/src/otr.c
@@ -500,15 +500,20 @@ void otr_auth(SERVER_REC *irssi, char *nick, const char *peername,
 		goto end;
 	}
 
-	ctx = get_otrl_context(accname, nick, FALSE, irssi);
+	ctx = get_otrl_context(accname, nick, 0, irssi);
 	if (!ctx) {
 		otr_noticest(TXT_CTX_NOT_FOUND, accname, nick);
 		goto end;
 	}
 
 	opc = ctx->app_data;
-	/* Shoud NOT happen */
-	assert(opc);
+	if (!opc) {
+		opc = otr_create_peer_context();
+		if (!opc) {
+			goto end;
+		}
+		ctx->app_data = opc;
+	}
 
 	if (ctx->msgstate != OTRL_MSGSTATE_ENCRYPTED) {
 		otr_notice(irssi, nick, TXT_AUTH_NEEDENC);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/irssi-plugin-otr.git



More information about the Pkg-privacy-commits mailing list