[Pkg-privacy-commits] [irssi-plugin-otr] 103/267: Fix bad free and message handling
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 12:41:33 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 50bc97675d716f4bdea308a50ef175272195c682
Author: David Goulet <dgoulet at ev0ke.net>
Date: Sat Nov 3 21:20:04 2012 -0400
Fix bad free and message handling
Signed-off-by: David Goulet <dgoulet at ev0ke.net>
---
src/key.c | 5 -----
src/module.c | 18 +++++++++++++++---
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/src/key.c b/src/key.c
index acb4334..e2fc9dc 100644
--- a/src/key.c
+++ b/src/key.c
@@ -179,7 +179,6 @@ void key_generation_run(IOUSTATE *ioustate, const char *accname)
kg_st.started = time(NULL);
if ((ret = fork())) {
- g_free(filename);
if (ret == -1) {
otr_noticest(TXT_KG_FORK, accname, strerror(errno));
goto end;
@@ -260,7 +259,6 @@ void key_write_fingerprints(IOUSTATE *ioustate)
g_free(filename);
}
-#ifndef LIBOTR3
/*
* Write instance tags to file.
*/
@@ -279,7 +277,6 @@ void otr_writeinstags(IOUSTATE *ioustate)
g_free(filename);
}
-#endif
/*
* Load private keys.
@@ -333,7 +330,6 @@ end:
return;
}
-#ifndef LIBOTR3
/*
* Load instance tags.
*/
@@ -359,4 +355,3 @@ end:
g_free(filename);
return;
}
-#endif
diff --git a/src/module.c b/src/module.c
index 7509b03..45e7827 100644
--- a/src/module.c
+++ b/src/module.c
@@ -68,7 +68,13 @@ static void sig_server_sendmsg(SERVER_REC *server, const char *target,
goto end;
}
- signal_continue(4, server, target, otrmsg, target_type_p);
+ if (!otrmsg) {
+ /* Send original message */
+ signal_continue(4, server, target, msg, target_type_p);
+ } else {
+ /* Send encrypted message */
+ signal_continue(4, server, target, otrmsg, target_type_p);
+ }
end:
otrl_message_free(otrmsg);
@@ -82,7 +88,7 @@ static void sig_message_private(SERVER_REC *server, const char *msg,
const char *nick, const char *address)
{
int ret;
- char *new_msg;
+ char *new_msg = NULL;
#ifdef HAVE_GREGEX_H
if (g_regex_match(regex_nickignore, nick, 0, NULL)) {
@@ -96,7 +102,13 @@ static void sig_message_private(SERVER_REC *server, const char *msg,
goto end;
}
- signal_continue(4, server, new_msg, nick, address);
+ if (!new_msg) {
+ /* This message was not OTR */
+ signal_continue(4, server, msg, nick, address);
+ } else {
+ /* OTR received message */
+ signal_continue(4, server, new_msg, nick, address);
+ }
end:
otrl_message_free(new_msg);
--
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