Package: irssi-plugin-xmpp / 0.54-3

singpolyma-0007-Fix-segfault.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From 20b181d678ad167395ab4c9f969c8517863fd73f Mon Sep 17 00:00:00 2001
From: Stephen Paul Weber <singpolyma@singpolyma.net>
Date: Sat, 23 Apr 2011 13:54:08 -0500
Subject: [PATCH 07/18] Fix segfault

---
 src/core/rosters.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/src/core/rosters.c
+++ b/src/core/rosters.c
@@ -139,6 +139,7 @@
 	resource->status = NULL;
 	resource->composing_id = NULL;
 	resource->pgp_keyid = NULL;
+	resource->pgp_encrypt = 0;
 	return resource;
 }
 
@@ -518,7 +519,7 @@
 			free(send_to_gpg);
 
 			/* If there is a good signature, grab the key ID */
-			if(strstr(from_gpg, "Good signature from")) {
+			if(from_gpg && strstr(from_gpg, "Good signature from")) {
 				char *s = strstr(from_gpg, "key ID ");
 				if(s) {
 					pgp_keyid = malloc(sizeof(*pgp_keyid)*9);
@@ -526,7 +527,7 @@
 					pgp_keyid[8] = '\0';
 				}
 			}
-			free(from_gpg);
+			if(from_gpg) free(from_gpg);
 		}
 		update_user_presence(server, from,
 		    node_show != NULL ? node_show->value : NULL, status,