summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorray <ray@openbsd.org>2007-09-26 02:46:29 +0000
committerray <ray@openbsd.org>2007-09-26 02:46:29 +0000
commit451bd517f7dfaaff68628f3939ef01a806117a04 (patch)
treef4d402607f683edf2734bbd5375370416f7778d6
parentHandle incoming protocol reject packets now that we have (diff)
downloadwireguard-openbsd-451bd517f7dfaaff68628f3939ef01a806117a04.tar.xz
wireguard-openbsd-451bd517f7dfaaff68628f3939ef01a806117a04.zip
From Tamas TEVESZ:
- atoi -> strtonum with proper bounds check - Use vfprintf and vsyslog in the appropriate places. OK millert.
-rw-r--r--libexec/identd/identd.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libexec/identd/identd.c b/libexec/identd/identd.c
index 5b34e7507e5..738e7e11b9f 100644
--- a/libexec/identd/identd.c
+++ b/libexec/identd/identd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: identd.c,v 1.45 2007/09/25 14:21:30 jmc Exp $ */
+/* $OpenBSD: identd.c,v 1.46 2007/09/26 02:46:29 ray Exp $ */
/*
* This program is in the public domain and may be used freely by anyone
@@ -157,6 +157,7 @@ main(int argc, char *argv[])
gid_t set_gid = 0;
extern char *optarg;
socklen_t len;
+ const char *errstr;
openlog(__progname, LOG_PID, LOG_DAEMON);
@@ -192,7 +193,9 @@ main(int argc, char *argv[])
background_flag = 0;
break;
case 't':
- timeout = atoi(optarg);
+ timeout = strtonum(optarg, 0, 100000000, &errstr);
+ if (errstr)
+ error("timeout is %s: %s", errstr, optarg);
break;
case 'p':
portno = optarg;
@@ -482,12 +485,12 @@ error(char *fmt, ...)
if (syslog_flag) {
va_copy(ap2, ap);
- syslog(LOG_ERR, fmt, ap2);
+ vsyslog(LOG_ERR, fmt, ap2);
va_end(ap2);
}
if (debug_flag) {
fprintf(stderr, "%d , %d : ERROR : X-DBG : ", lport, fport);
- fprintf(stderr, fmt, ap);
+ vfprintf(stderr, fmt, ap);
perror(": ");
} else
printf("%d , %d : ERROR : UNKNOWN-ERROR\r\n", lport, fport);