summaryrefslogtreecommitdiff
path: root/libexec/rpc.rstatd
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-04-18 18:28:39 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-04-18 18:28:39 +0000
commit82e40d211902d486d2871a1bc691d1768927efd5 (patch)
tree73caeece4da00dad32b1e62383474772aae90893 /libexec/rpc.rstatd
parenta15dfcc7862a97d34cf8fed2bb1292c14721e771 (diff)
Convert many atoi() calls to strtonum(), adding range checks and failure
handling along the way. Reviews by Brendan MacDonell, Jeremy Devenport, florian, doug, millert
Diffstat (limited to 'libexec/rpc.rstatd')
-rw-r--r--libexec/rpc.rstatd/rstatd.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libexec/rpc.rstatd/rstatd.c b/libexec/rpc.rstatd/rstatd.c
index 237504393b2..fb37cb3c896 100644
--- a/libexec/rpc.rstatd/rstatd.c
+++ b/libexec/rpc.rstatd/rstatd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rstatd.c,v 1.26 2015/03/13 03:24:27 deraadt Exp $ */
+/* $OpenBSD: rstatd.c,v 1.27 2015/04/18 18:28:37 deraadt Exp $ */
/*-
* Copyright (c) 1993, John Brezak
@@ -34,6 +34,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <signal.h>
#include <pwd.h>
#include <syslog.h>
@@ -65,6 +66,7 @@ main(int argc, char *argv[])
socklen_t fromlen;
struct passwd *pw;
struct sockaddr_storage from;
+ const char *errstr;
SVCXPRT *transp;
openlog("rpc.rstatd", LOG_NDELAY|LOG_CONS|LOG_PID, LOG_DAEMON);
@@ -88,8 +90,8 @@ main(int argc, char *argv[])
}
if (argc == 2)
- closedown = atoi(argv[1]);
- if (closedown <= 0)
+ closedown = strtonum(argv[1], 1, INT_MAX, NULL);
+ if (closedown == 0)
closedown = 20;
/*