| 1 |
From 20b181d678ad167395ab4c9f969c8517863fd73f Mon Sep 17 00:00:00 2001 |
| 2 |
From: Stephen Paul Weber <[email protected]> |
| 3 |
Date: Sat, 23 Apr 2011 13:54:08 -0500 |
| 4 |
Subject: [PATCH 07/18] Fix segfault |
| 5 |
|
| 6 |
--- |
| 7 |
src/core/rosters.c | 5 +++-- |
| 8 |
1 file changed, 3 insertions(+), 2 deletions(-) |
| 9 |
|
| 10 |
--- a/src/core/rosters.c |
| 11 |
+++ b/src/core/rosters.c |
| 12 |
@@ -140,6 +140,7 @@ |
| 13 |
resource->status = NULL; |
| 14 |
resource->composing_id = NULL; |
| 15 |
resource->pgp_keyid = NULL; |
| 16 |
+ resource->pgp_encrypt = 0; |
| 17 |
return resource; |
| 18 |
} |
| 19 |
|
| 20 |
@@ -518,7 +519,7 @@ |
| 21 |
free(send_to_gpg); |
| 22 |
|
| 23 |
/* If there is a good signature, grab the key ID */ |
| 24 |
- if(strstr(from_gpg, "Good signature from")) { |
| 25 |
+ if(from_gpg && strstr(from_gpg, "Good signature from")) { |
| 26 |
char *s = strstr(from_gpg, "key ID "); |
| 27 |
if(s) { |
| 28 |
pgp_keyid = malloc(sizeof(*pgp_keyid)*9); |
| 29 |
@@ -526,7 +527,7 @@ |
| 30 |
pgp_keyid[8] = '\0'; |
| 31 |
} |
| 32 |
} |
| 33 |
- free(from_gpg); |
| 34 |
+ if(from_gpg) free(from_gpg); |
| 35 |
} |
| 36 |
update_user_presence(server, from, |
| 37 |
node_show != NULL ? node_show->value : NULL, status, |