From: Wilfried Goesgens Date: Mon, 4 Oct 2010 22:14:33 +0000 (+0200) Subject: * StrBufSanitizeEmailRecipientVector () fix another off by one X-Git-Tag: v7.86~47 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=e60714f29e56a5d85b215f6701fa87e294661d26 * StrBufSanitizeEmailRecipientVector () fix another off by one --- diff --git a/libcitadel/lib/stringbuf.c b/libcitadel/lib/stringbuf.c index fcbd1daa7..5c538310f 100644 --- a/libcitadel/lib/stringbuf.c +++ b/libcitadel/lib/stringbuf.c @@ -2538,7 +2538,6 @@ StrBuf *StrBufSanitizeEmailRecipientVector(const StrBuf *Recp, pch = NULL; if (EmailEnd != NULL) { gt = 1; - EmailEnd --; } else { EmailEnd = pche; @@ -2564,7 +2563,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 14d66c261..3b8ba3d0b 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