[pkg-otr-team] [irssi-plugin-otr] 138/167: Change a malloc+strcpy into a strdup in process_receiving_im()

Holger Levsen holger at moszumanska.debian.org
Mon Mar 3 21:55:39 UTC 2014


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

holger pushed a commit to tag 4.0.0
in repository irssi-plugin-otr.

commit 03f11def8d0123eb43b12ba4d6499c1d53baf34a
Author: Ian Goldberg <iang at cs.uwaterloo.ca>
Date:   Thu Jul 19 08:53:00 2012 -0400

    Change a malloc+strcpy into a strdup in process_receiving_im()
    
    Thanks to Paul Wouters <paul at cypherpunks.ca> for the report.
---
 otr-plugin.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/otr-plugin.c b/otr-plugin.c
index da93dbd..f9ba9f9 100644
--- a/otr-plugin.c
+++ b/otr-plugin.c
@@ -781,10 +781,7 @@ static gboolean process_receiving_im(PurpleAccount *account, char **who,
 	    &newmessage, &tlvs, NULL, NULL, NULL);
 
     if (newmessage) {
-	char *ourm = malloc(strlen(newmessage) + 1);
-	if (ourm) {
-	    strcpy(ourm, newmessage);
-	}
+	char *ourm = strdup(newmessage);
 	otrl_message_free(newmessage);
 	free(*message);
 	*message = ourm;

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



More information about the Pkg-otr-team mailing list