[gmime/gmime-2-4] Fixed a crash in group_to_string()
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime/gmime-2-4] Fixed a crash in group_to_string()
- Date: Thu, 2 Sep 2010 14:00:42 +0000 (UTC)
commit 5048300d233c5dda53091031bcb04f9e3c8a95fa
Author: Jeffrey Stedfast <fejj gnome org>
Date: Thu Sep 2 10:00:10 2010 -0400
Fixed a crash in group_to_string()
2010-09-02 Jeffrey Stedfast <fejj novell com>
* gmime/internet-address.c (group_to_string): Don't crash if the
group name is unset. Thanks to Damian Pietras for this patch.
ChangeLog | 5 +++++
gmime/internet-address.c | 21 ++++++++++++---------
2 files changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9253f26..5cbbd2d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-09-02 Jeffrey Stedfast <fejj novell com>
+
+ * gmime/internet-address.c (group_to_string): Don't crash if the
+ group name is unset. Thanks to Damian Pietras for this patch.
+
2010-09-01 Jeffrey Stedfast <fejj novell com>
* gmime/gmime-utils.c (g_mime_utils_header_decode_phrase):
diff --git a/gmime/internet-address.c b/gmime/internet-address.c
index 2c80b67..fc3da9f 100644
--- a/gmime/internet-address.c
+++ b/gmime/internet-address.c
@@ -1269,18 +1269,21 @@ group_to_string (InternetAddress *ia, guint32 flags, size_t *linelen, GString *s
InternetAddressGroup *group = (InternetAddressGroup *) ia;
gboolean encode = flags & INTERNET_ADDRESS_ENCODE;
gboolean fold = flags & INTERNET_ADDRESS_FOLD;
- char *name;
- size_t len;
-
- name = encoded_name (ia->name, encode);
- len = strlen (name);
+ char *name = NULL;
+ size_t len = 0;
- if (fold && *linelen > 1 && (*linelen + len + 1) > GMIME_FOLD_LEN) {
- linewrap (string);
- *linelen = 1;
+ if (ia->name != NULL) {
+ name = encoded_name (ia->name, encode);
+ len = strlen (name);
+
+ if (fold && *linelen > 1 && (*linelen + len + 1) > GMIME_FOLD_LEN) {
+ linewrap (string);
+ *linelen = 1;
+ }
+
+ g_string_append_len (string, name, len);
}
- g_string_append_len (string, name, len);
g_string_append_len (string, ": ", 2);
*linelen += len + 2;
g_free (name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]