From c72302f620b7b81247ca041159f46e37df1428b4 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Tue, 5 Oct 2010 00:14:33 +0200 Subject: [PATCH] * StrBufSanitizeEmailRecipientVector () fix another off by one --- libcitadel/lib/stringbuf.c | 7 +++++-- libcitadel/tests/email_recipientstrings.txt | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libcitadel/lib/stringbuf.c b/libcitadel/lib/stringbuf.c index d6d960dab..98acba782 100644 --- a/libcitadel/lib/stringbuf.c +++ b/libcitadel/lib/stringbuf.c @@ -2649,7 +2649,6 @@ StrBuf *StrBufSanitizeEmailRecipientVector(const StrBuf *Recp, pch = NULL; if (EmailEnd != NULL) { gt = 1; - EmailEnd --; } else { EmailEnd = pche; @@ -2675,7 +2674,11 @@ StrBuf *StrBufSanitizeEmailRecipientVector(const StrBuf *Recp, EmailStart = strchr(UserStart, '<'); if ((EmailStart == NULL) || (EmailStart > EmailEnd)) break; - UserEnd = EmailStart - 1; + UserEnd = EmailStart; + + while ((UserEnd > UserStart) && + isspace (*(UserEnd - 1))) + UserEnd --; EmailStart ++; if (UserStart >= UserEnd) UserStart = UserEnd = NULL; diff --git a/libcitadel/tests/email_recipientstrings.txt b/libcitadel/tests/email_recipientstrings.txt index 2d22ab098..f7877dd91 100644 --- a/libcitadel/tests/email_recipientstrings.txt +++ b/libcitadel/tests/email_recipientstrings.txt @@ -1,3 +1,4 @@ +Holger Müller "Alexandra Weiz, Restless GmbH" , "NetIN" , " יריב ברקאי, מולטימדי" , "Завод ЖБ" dothebart dothebart@uncensored.citadel.org -- 2.30.2