summaryrefslogtreecommitdiff
path: root/usr.sbin/syslogd
diff options
context:
space:
mode:
authorAnil Madhavapeddy <avsm@cvs.openbsd.org>2003-07-08 01:28:12 +0000
committerAnil Madhavapeddy <avsm@cvs.openbsd.org>2003-07-08 01:28:12 +0000
commitc2f1bc1298fd7370d1e9bb9232a0b0ca01089d69 (patch)
tree11c9c9b4a54ddaff1f344a6ac1918adc20883950 /usr.sbin/syslogd
parent39f68a32443fc676b370a2b6ea4357c5ff4f81a7 (diff)
dont silently truncate a domain socket specified via the -p argument;
error out instead if its too long. deraadt@ ok
Diffstat (limited to 'usr.sbin/syslogd')
-rw-r--r--usr.sbin/syslogd/syslogd.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index fabf61e4371..237ce3365b6 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syslogd.c,v 1.63 2003/06/02 23:36:54 millert Exp $ */
+/* $OpenBSD: syslogd.c,v 1.64 2003/07/08 01:28:11 avsm Exp $ */
/*
* Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94";
#else
-static char rcsid[] = "$OpenBSD: syslogd.c,v 1.63 2003/06/02 23:36:54 millert Exp $";
+static char rcsid[] = "$OpenBSD: syslogd.c,v 1.64 2003/07/08 01:28:11 avsm Exp $";
#endif
#endif /* not lint */
@@ -248,7 +248,12 @@ main(int argc, char *argv[])
NoDNS = 1;
break;
case 'p': /* path */
- funixn[0] = optarg;
+ if (strlen(optarg) >= sizeof(sunx.sun_path)) {
+ fprintf(stderr,
+ "syslogd: socket path too long, exiting\n");
+ exit(1);
+ } else
+ funixn[0] = optarg;
break;
case 'u': /* allow udp input port */
SecureMode = 0;