diff options
author | 2014-04-19 17:12:02 +0000 | |
---|---|---|
committer | 2014-04-19 17:12:02 +0000 | |
commit | 523ccb3a708564827a40ff1fb15e9306e3d8a8f2 (patch) | |
tree | 6209201a271ce09febcb0a4fafbeacfc605badf4 | |
parent | (void) cast strlcpy() calls that cannot truncate (diff) | |
download | wireguard-openbsd-523ccb3a708564827a40ff1fb15e9306e3d8a8f2.tar.xz wireguard-openbsd-523ccb3a708564827a40ff1fb15e9306e3d8a8f2.zip |
add missing strlcpy() check when parsing "backup hostname" in smtpd.conf,
it could lead to smtpd not finding itself in a MX lookup if a hostname is
specified that exceeds the max hostname len.
while at it, add a missing free()
-rw-r--r-- | usr.sbin/smtpd/parse.y | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y index 1b73fd24f74..afac7c71478 100644 --- a/usr.sbin/smtpd/parse.y +++ b/usr.sbin/smtpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.139 2014/04/19 17:08:49 gilles Exp $ */ +/* $OpenBSD: parse.y,v 1.140 2014/04/19 17:12:02 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -481,8 +481,14 @@ opt_relay_common: AS STRING { opt_relay : BACKUP STRING { rule->r_value.relayhost.flags |= F_BACKUP; - strlcpy(rule->r_value.relayhost.hostname, $2, - sizeof (rule->r_value.relayhost.hostname)); + if (strlcpy(rule->r_value.relayhost.hostname, $2, + sizeof (rule->r_value.relayhost.hostname)) + >= sizeof (rule->r_value.relayhost.hostname)) { + log_warnx("hostname too long: %s", $2); + free($2); + YYERROR; + } + free($2); } | BACKUP { rule->r_value.relayhost.flags |= F_BACKUP; |