[gmime] Improved address parser: allow unquoted ,'s and .'s



commit a0f6833d2128fcc8ff24ef50ace53b1e1c0b2c07
Author: Jeffrey Stedfast <jestedfa microsoft com>
Date:   Wed Feb 8 14:58:39 2017 -0500

    Improved address parser: allow unquoted ,'s and .'s

 gmime/internet-address.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/gmime/internet-address.c b/gmime/internet-address.c
index 5a2a88a..863d4c3 100644
--- a/gmime/internet-address.c
+++ b/gmime/internet-address.c
@@ -1666,6 +1666,7 @@ address_parse (GMimeParserOptions *options, AddressParserFlags flags, const char
        const char *inptr = *in;
        const char *start;
        size_t length;
+       int words = 0;
        
        if (!skip_cfws (&inptr) || *inptr == '\0')
                goto error;
@@ -1708,7 +1709,21 @@ address_parse (GMimeParserOptions *options, AddressParserFlags flags, const char
                                break;
                        
                        inptr++;
+                       
+                       length = (size_t) (inptr - start);
                } while (TRUE);
+               
+               words++;
+               
+               /* Note: some clients don't quote commas in the name */
+               if (*inptr == ',' && words > 1) {
+                       inptr++;
+
+                       length = (size_t) (inptr - start);
+                       
+                       if (!skip_cfws (&inptr))
+                               goto error;
+               }
        }
        
        if (!skip_cfws (&inptr))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]