summaryrefslogtreecommitdiffstats
path: root/libexec/comsat/comsat.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2015-01-16 06:39:28 +0000
committerderaadt <deraadt@openbsd.org>2015-01-16 06:39:28 +0000
commitb9fc9a728fce9c4289b7e9a992665e28d5629a54 (patch)
tree72b2433e418dfa1aef5fcf8305617b97979a25d8 /libexec/comsat/comsat.c
parentimprove checksum parsing slightly. now handles filenames with spaces. (diff)
downloadwireguard-openbsd-b9fc9a728fce9c4289b7e9a992665e28d5629a54.tar.xz
wireguard-openbsd-b9fc9a728fce9c4289b7e9a992665e28d5629a54.zip
Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
Diffstat (limited to 'libexec/comsat/comsat.c')
-rw-r--r--libexec/comsat/comsat.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libexec/comsat/comsat.c b/libexec/comsat/comsat.c
index 0e4b0a5cc22..b77ef5aa13b 100644
--- a/libexec/comsat/comsat.c
+++ b/libexec/comsat/comsat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: comsat.c,v 1.37 2012/12/04 02:24:47 deraadt Exp $ */
+/* $OpenBSD: comsat.c,v 1.38 2015/01/16 06:39:49 deraadt Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -40,6 +40,7 @@
#include <errno.h>
#include <fcntl.h>
#include <netdb.h>
+#include <limits.h>
#include <paths.h>
#include <pwd.h>
#include <signal.h>
@@ -57,7 +58,7 @@ int debug = 0;
#define MAXIDLE 120
-char hostname[MAXHOSTNAMELEN];
+char hostname[HOST_NAME_MAX+1];
struct utmp *utmp = NULL;
time_t lastmsgtime;
int nutmp, uf;
@@ -222,7 +223,7 @@ notify(struct utmp *utp, off_t offset)
FILE *tp;
struct stat stb;
struct termios ttybuf;
- char tty[MAXPATHLEN], name[UT_NAMESIZE + 1];
+ char tty[PATH_MAX], name[UT_NAMESIZE + 1];
(void)snprintf(tty, sizeof(tty), "%s%.*s",
_PATH_DEV, (int)sizeof(utp->ut_line), utp->ut_line);