diff options
author | 2014-04-19 17:23:19 +0000 | |
---|---|---|
committer | 2014-04-19 17:23:19 +0000 | |
commit | 325d28effc5f5df169c3a9d9b4c9fa9bb7d5472d (patch) | |
tree | c2db6732f5da3dd4cb45b4810e5fa78bf3b4fed1 | |
parent | add missing strlcpy() checks in create_filter() that would cause smtpd to (diff) | |
download | wireguard-openbsd-325d28effc5f5df169c3a9d9b4c9fa9bb7d5472d.tar.xz wireguard-openbsd-325d28effc5f5df169c3a9d9b4c9fa9bb7d5472d.zip |
add missing strlcpy() check in create_filter_chain() that would cause smtpd
to fatal at startup if truncation occured and we had enabled filters
(void) cast a strlcpy() that cannot truncate
-rw-r--r-- | usr.sbin/smtpd/parse.y | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y index dee50d45e04..b80ee85dd8e 100644 --- a/usr.sbin/smtpd/parse.y +++ b/usr.sbin/smtpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.142 2014/04/19 17:21:19 gilles Exp $ */ +/* $OpenBSD: parse.y,v 1.143 2014/04/19 17:23:19 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -2143,7 +2143,11 @@ create_filter_chain(const char *name) return (NULL); } f = xcalloc(1, sizeof(*f), "create_filter_chain"); - strlcpy(f->name, name, sizeof(f->name)); + if (strlcpy(f->name, name, sizeof(f->name)) >= + sizeof(f->name)) { + yyerror("filter chain name \"%s\" too long", name); + return (NULL); + } f->chain = 1; dict_xset(&conf->sc_filters, name, f); @@ -2172,7 +2176,7 @@ extend_filter_chain(struct filter *f, const char *name) for (i = 0; i < MAX_FILTER_PER_CHAIN; i++) { if (f->filters[i][0] == '\0') { - strlcpy(f->filters[i], name, sizeof(f->filters[i])); + (void)strlcpy(f->filters[i], name, sizeof(f->filters[i])); return (1); } } |