From: Wilfried Goesgens Date: Mon, 4 Oct 2010 22:14:33 +0000 (+0200) Subject: * StrBufSanitizeEmailRecipientVector () fix another off by one X-Git-Tag: v8.01~679 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=c72302f620b7b81247ca041159f46e37df1428b4 * StrBufSanitizeEmailRecipientVector () fix another off by one --- 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