[gmime-devel] Crash when parsing invalid group mail address
- From: Damian Pietras <daper daper net>
- To: gmime-devel-list gnome org
- Subject: [gmime-devel] Crash when parsing invalid group mail address
- Date: Thu, 2 Sep 2010 15:48:25 +0200
This email address will cause current gmime (git) crash:
:) <test test>
it causes NULL dereference, a simple patch is attached.
--
Damian Pietras
http://www.linuxprogrammingblog.com
Index: gmime/internet-address.c
===================================================================
--- gmime/internet-address.c (revision 5791)
+++ gmime/internet-address.c (working copy)
@@ -1269,18 +1269,21 @@
InternetAddressGroup *group = (InternetAddressGroup *) ia;
gboolean encode = flags & INTERNET_ADDRESS_ENCODE;
gboolean fold = flags & INTERNET_ADDRESS_FOLD;
- char *name;
- size_t len;
+ char *name = NULL;
+ size_t len = 0;
- name = encoded_name (ia->name, encode);
- len = strlen (name);
+ if (ia->name) {
+ name = encoded_name (ia->name, encode);
+ len = strlen (name);
- if (fold && *linelen > 1 && (*linelen + len + 1) > GMIME_FOLD_LEN) {
- linewrap (string);
- *linelen = 1;
+ 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]