summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgilles <gilles@openbsd.org>2014-10-12 18:58:57 +0000
committergilles <gilles@openbsd.org>2014-10-12 18:58:57 +0000
commit2da186d27f1dfd7c462ccff3aced4c486424818f (patch)
treec218bc34cdf23e8ce3cd96d982ac1316977052c9
parentto rewrite domain on incoming mails, we need to be able to extract (diff)
downloadwireguard-openbsd-2da186d27f1dfd7c462ccff3aced4c486424818f.tar.xz
wireguard-openbsd-2da186d27f1dfd7c462ccff3aced4c486424818f.zip
do not allow header to termine with pending flags
-rw-r--r--usr.sbin/smtpd/rfc822.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/rfc822.c b/usr.sbin/smtpd/rfc822.c
index b598fa1ff07..1e0ca34f352 100644
--- a/usr.sbin/smtpd/rfc822.c
+++ b/usr.sbin/smtpd/rfc822.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rfc822.c,v 1.1 2014/10/12 18:54:31 gilles Exp $ */
+/* $OpenBSD: rfc822.c,v 1.2 2014/10/12 18:58:57 gilles Exp $ */
/*
* Copyright (c) 2014 Gilles Chehade <gilles@poolp.org>
@@ -83,6 +83,10 @@ parse_addresses(struct rfc822_parser *rp, const char *buffer, size_t len)
*wptr++ = *s;
}
+ /* some flags still set, malformed header */
+ if (rp->escape || rp->comment || rp->quote || rp->bracket)
+ return 0;
+
/* no value, malformed header */
if (ra->name[0] == '\0' && ra->address[0] == '\0')
return 0;