[gmime/gmime-2-4] Handle more malformed addresses
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime/gmime-2-4] Handle more malformed addresses
- Date: Tue, 30 Nov 2010 01:35:59 +0000 (UTC)
commit 4af7b14afa3340d70484fcaf39c5440e4c1d642c
Author: Jeffrey Stedfast <fejj gnome org>
Date: Mon Nov 29 20:35:17 2010 -0500
Handle more malformed addresses
2010-11-29 Jeffrey Stedfast <fejj novell com>
* gmime/internet-address.c (decode_address): Handle edge cases
where inptr reaches the end of the input string prematurely due
to
a malformed address.
ChangeLog | 6 ++++++
gmime/internet-address.c | 9 +++++----
tests/test-mime.c | 3 +++
3 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 43f00ad..f946363 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-11-29 Jeffrey Stedfast <fejj novell com>
+
+ * gmime/internet-address.c (decode_address): Handle edge cases
+ where inptr reaches the end of the input string prematurely due to
+ a malformed address.
+
2010-11-21 Jeffrey Stedfast <fejj novell com>
Fixes bug #635407.
diff --git a/gmime/internet-address.c b/gmime/internet-address.c
index 8c9039b..9aa88dd 100644
--- a/gmime/internet-address.c
+++ b/gmime/internet-address.c
@@ -1517,10 +1517,9 @@ decode_address (const char **in)
* tokens that make up this name phrase.
**/
while (*inptr) {
- if ((word = decode_word (&inptr)))
+ if ((word = decode_word (&inptr))) {
g_string_append_len (name, word, (size_t) (inptr - word));
-
- if (word) {
+
check_lwsp:
word = inptr;
skip_lwsp (&inptr);
@@ -1576,7 +1575,7 @@ decode_address (const char **in)
} else if (*inptr == '(') {
/* beginning of a comment, use decode_lwsp() to skip past it */
decode_lwsp (&inptr);
- } else if (strchr ("@,;", *inptr)) {
+ } else if (*inptr && strchr ("@,;", *inptr)) {
if (name->len == 0) {
if (*inptr == '@') {
GString *domain;
@@ -1631,6 +1630,8 @@ decode_address (const char **in)
inptr++;
goto check_lwsp;
+ } else {
+ goto addrspec;
}
}
diff --git a/tests/test-mime.c b/tests/test-mime.c
index 49962e6..af30c7f 100644
--- a/tests/test-mime.c
+++ b/tests/test-mime.c
@@ -191,6 +191,9 @@ static struct {
{ "\"=?ISO-8859-2?Q?TEST?=\" <p p org>",
"TEST <p p org>",
"TEST <p p org>" },
+ { "sdfasf wp pl,c tert wp pl,sffdg rtre op pl",
+ "sdfasf wp pl, c, sffdg rtre op pl",
+ "sdfasf wp pl, c, sffdg rtre op pl" },
};
static struct {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]