summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2019-08-10 09:35:44 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2019-08-10 09:35:44 +0000
commitb2f897cc808359256fb0bdf050fae235bbc84c23 (patch)
tree813b40c0b0f1df084f9ca9c850ba4d0a5362778f
parente19f28fe9f16fc0db30d97e7a7688801e8494aec (diff)
valid_domainpart() uses res_hnok() internally which considers the hostnames
ending with a dot to be valid. add a check to make sure that if domain part ends with a dot, it is rejected as it should. issue reported by Hans Freitag <hans.freitag@conesphere.com>
-rw-r--r--usr.sbin/smtpd/util.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/util.c b/usr.sbin/smtpd/util.c
index 30fea943cae..509e9ffe6e4 100644
--- a/usr.sbin/smtpd/util.c
+++ b/usr.sbin/smtpd/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.142 2019/07/03 03:24:03 deraadt Exp $ */
+/* $OpenBSD: util.c,v 1.143 2019/08/10 09:35:43 gilles Exp $ */
/*
* Copyright (c) 2000,2001 Markus Friedl. All rights reserved.
@@ -537,6 +537,9 @@ valid_domainpart(const char *s)
if (*s == '\0')
return 0;
+ if (s[strlen(s) - 1] == '.')
+ return 0;
+
return res_hnok(s);
}