From 1f08008eb615395e0e38573d1890f80519c111c4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Sat, 24 Jul 2010 10:30:45 +0000 Subject: [PATCH 1/1] * StrBufSanitizeEmailRecipientVector () fix null pointer accesses --- libcitadel/lib/stringbuf.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libcitadel/lib/stringbuf.c b/libcitadel/lib/stringbuf.c index 861c1d2f9..250b3109c 100644 --- a/libcitadel/lib/stringbuf.c +++ b/libcitadel/lib/stringbuf.c @@ -2582,19 +2582,24 @@ StrBuf *StrBufSanitizeEmailRecipientVector(const StrBuf *Recp, } } - - if (UserStart != NULL) + if ((UserStart != NULL) && (UserEnd != NULL)) + StrBufPlain(UserName, UserStart, UserEnd - UserStart); + else if ((UserStart != NULL) && (UserEnd == NULL)) StrBufPlain(UserName, UserStart, UserEnd - UserStart); else FlushStrBuf(UserName); - if (EmailStart != NULL) + + if ((EmailStart != NULL) && (EmailEnd != NULL)) StrBufPlain(EmailAddress, EmailStart, EmailEnd - EmailStart); + else if ((EmailStart != NULL) && (EmailEnd == NULL)) + StrBufPlain(EmailAddress, EmailStart, EmailEnd - pche); else FlushStrBuf(EmailAddress); AddRecipient(Target, UserName, EmailAddress, EncBuf); - + if (pch == NULL) + break; if ((pch != NULL) && (*pch == ',')) pch ++; -- 2.39.2