summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgilles <gilles@openbsd.org>2014-04-19 11:29:06 +0000
committergilles <gilles@openbsd.org>2014-04-19 11:29:06 +0000
commitffd15e3fde4e85aeafa22b4a67fca48c545bc70a (patch)
tree6ce081d0e349ea8f493e5ed69ae344398593ad91
parentthe altq versions of the IFQ_* macros can finally go. chances of this (diff)
downloadwireguard-openbsd-ffd15e3fde4e85aeafa22b4a67fca48c545bc70a.tar.xz
wireguard-openbsd-ffd15e3fde4e85aeafa22b4a67fca48c545bc70a.zip
when copying socket path, check that we didnt truncate it which would cause
the following connect() to fail.
-rw-r--r--usr.sbin/smtpd/delivery_lmtp.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.sbin/smtpd/delivery_lmtp.c b/usr.sbin/smtpd/delivery_lmtp.c
index b40dbc0e0d0..8fb47877474 100644
--- a/usr.sbin/smtpd/delivery_lmtp.c
+++ b/usr.sbin/smtpd/delivery_lmtp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: delivery_lmtp.c,v 1.4 2013/12/26 17:25:32 eric Exp $ */
+/* $OpenBSD: delivery_lmtp.c,v 1.5 2014/04/19 11:29:06 gilles Exp $ */
/*
* Copyright (c) 2013 Ashish SHUKLA <ashish.is@lostca.se>
@@ -116,7 +116,12 @@ unix_socket(char *path) {
}
addr.sun_family = AF_UNIX;
- strlcpy(addr.sun_path, path, sizeof(addr.sun_path));
+ if (strlcpy(addr.sun_path, path, sizeof(addr.sun_path))
+ >= sizeof(addr.sun_path)) {
+ warnx("strlcpy: socket path too long");
+ close(s);
+ return -1;
+ }
if (connect(s, (struct sockaddr*) &addr, sizeof(addr)) == -1) {
warn("connect");