if (Buf == NULL) return -1;
xferbuf = (char*) malloc(Buf->BufSize);
+ *xferbuf = '\0';
siz = CtdlDecodeBase64(xferbuf,
Buf->buf,
Buf->BufUsed);
else {
pch = EmailEnd + 1;
- while ((EmailEnd > UserStart) &&
+ while ((EmailEnd > UserStart) && !gt &&
((*EmailEnd == ',') ||
(*EmailEnd == '>') ||
(isspace(*EmailEnd))))
{
if (*EmailEnd == '>')
gt = 1;
- EmailEnd--;
+ else
+ EmailEnd--;
}
if (EmailEnd == UserStart)
break;
}
}
-
- 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 ++;