aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/src/parseaddr.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/sendmail/src/parseaddr.c')
-rw-r--r--contrib/sendmail/src/parseaddr.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/contrib/sendmail/src/parseaddr.c b/contrib/sendmail/src/parseaddr.c
index 5d82f75fb85e..83b0e44ddd89 100644
--- a/contrib/sendmail/src/parseaddr.c
+++ b/contrib/sendmail/src/parseaddr.c
@@ -402,7 +402,7 @@ u_char MimeTokenTab[256] =
};
-# define NOCHAR -1 /* signal nothing in lookahead token */
+# define NOCHAR (-1) /* signal nothing in lookahead token */
char **
prescan(addr, delim, pvpbuf, pvpbsize, delimptr, toktab)
@@ -485,6 +485,7 @@ prescan(addr, delim, pvpbuf, pvpbsize, delimptr, toktab)
/* see if there is room */
if (q >= &pvpbuf[pvpbsize - 5])
{
+ addrtoolong:
usrerr("553 Address too long");
if (strlen(addr) > (SIZE_T) MAXNAME)
addr[MAXNAME] = '\0';
@@ -496,11 +497,15 @@ prescan(addr, delim, pvpbuf, pvpbsize, delimptr, toktab)
}
/* squirrel it away */
+#if !ALLOW_255
+ if ((char) c == (char) -1 && !tTd(82, 101))
+ c &= 0x7f;
+#endif /* !ALLOW_255 */
*q++ = c;
}
/* read a new input character */
- c = *p++;
+ c = (*p++) & 0x00ff;
if (c == '\0')
{
/* diagnose and patch up bad syntax */
@@ -555,6 +560,9 @@ prescan(addr, delim, pvpbuf, pvpbsize, delimptr, toktab)
}
else if (c != '!' || state == QST)
{
+ /* see if there is room */
+ if (q >= &pvpbuf[pvpbsize - 5])
+ goto addrtoolong;
*q++ = '\\';
continue;
}
@@ -636,6 +644,9 @@ prescan(addr, delim, pvpbuf, pvpbsize, delimptr, toktab)
/* new token */
if (tok != q)
{
+ /* see if there is room */
+ if (q >= &pvpbuf[pvpbsize - 5])
+ goto addrtoolong;
*q++ = '\0';
if (tTd(22, 36))
{