*last = cur;
}
+#define terminate_string(a, b) do { if (b < sizeof(a) - 1) a[b] = 0; else \
+ a[sizeof(a) - 1] = 0; } while (0)
+
ADDRESS *rfc822_parse_adrlist (ADDRESS *top, const char *s)
{
const char *begin, *ps;
{
if (phraselen)
{
- phrase[phraselen] = 0;
+ terminate_string (phrase, phraselen);
add_addrspec (&top, &last, phrase, comment, &commentlen, sizeof (comment) - 1);
}
else if (commentlen && last && !last->personal)
{
- comment[commentlen] = 0;
+ terminate_string (comment, commentlen);
last->personal = safe_strdup (comment);
}
else if (*s == ':')
{
cur = rfc822_new_address ();
- phrase[phraselen] = 0;
+ terminate_string (phrase, phraselen);
cur->mailbox = safe_strdup (phrase);
cur->group = 1;
{
if (phraselen)
{
- phrase[phraselen] = 0;
+ terminate_string (phrase, phraselen);
add_addrspec (&top, &last, phrase, comment, &commentlen, sizeof (comment) - 1);
}
else if (commentlen && last && !last->personal)
{
- comment[commentlen] = 0;
+ terminate_string (phrase, phraselen);
last->personal = safe_strdup (comment);
}
#ifdef EXACT_ADDRESS
}
else if (*s == '<')
{
- phrase[phraselen] = 0;
+ terminate_string (phrase, phraselen);
cur = rfc822_new_address ();
if (phraselen)
{
if (phraselen)
{
- phrase[phraselen] = 0;
- comment[commentlen] = 0;
+ terminate_string (phrase, phraselen);
+ terminate_string (comment, commentlen);
add_addrspec (&top, &last, phrase, comment, &commentlen, sizeof (comment) - 1);
}
else if (commentlen && last && !last->personal)
{
- comment[commentlen] = 0;
+ terminate_string (comment, commentlen);
last->personal = safe_strdup (comment);
}
#ifdef EXACT_ADDRESS