summaryrefslogtreecommitdiff
path: root/libexec/identd
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2007-09-26 02:46:30 +0000
committerRay Lai <ray@cvs.openbsd.org>2007-09-26 02:46:30 +0000
commit40b760dbca92959c0b43e9ee3303e5130b5bccfb (patch)
tree94f0d6d6cd4db43c9b88006ad414d3ee7596b229 /libexec/identd
parent6131bf46cac53f62484a14ab01cd3ac87ba77961 (diff)
From Tamas TEVESZ:
- atoi -> strtonum with proper bounds check - Use vfprintf and vsyslog in the appropriate places. OK millert.
Diffstat (limited to 'libexec/identd')
-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);