summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortobias <tobias@openbsd.org>2007-11-09 16:03:25 +0000
committertobias <tobias@openbsd.org>2007-11-09 16:03:25 +0000
commita835f639facec740cf3da2f403fe715d12d21827 (patch)
tree8ecc8d71c8aa0c3c4f4aeb92a0c62fe71d6b61a2
parentwhen "max <number>" is exceeded, packets are not dropped - rather they (diff)
downloadwireguard-openbsd-a835f639facec740cf3da2f403fe715d12d21827.tar.xz
wireguard-openbsd-a835f639facec740cf3da2f403fe715d12d21827.zip
An umask is octet not decimal. This means we cannot use strtonum() to
parse it due to base 10. Instead strtol() with base 8 must be used.
-rw-r--r--usr.bin/cvs/config.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/usr.bin/cvs/config.c b/usr.bin/cvs/config.c
index 0c52093b34a..99d56d80b67 100644
--- a/usr.bin/cvs/config.c
+++ b/usr.bin/cvs/config.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: config.c,v 1.11 2007/10/18 12:13:20 tobias Exp $ */
+/* $OpenBSD: config.c,v 1.12 2007/11/09 16:03:25 tobias Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -20,6 +20,7 @@
#include <sys/resource.h>
#include <errno.h>
+#include <limits.h>
#include <stdlib.h>
#include <string.h>
@@ -33,7 +34,7 @@ cvs_parse_configfile(void)
size_t len;
struct rlimit rl;
const char *errstr;
- char *p, *buf, *lbuf, *opt, *val, fpath[MAXPATHLEN];
+ char *p, *buf, *ep, *lbuf, *opt, *val, fpath[MAXPATHLEN];
(void)xsnprintf(fpath, sizeof(fpath), "%s/%s",
current_cvsroot->cr_dir, CVS_PATH_CONFIG);
@@ -78,10 +79,14 @@ cvs_parse_configfile(void)
xfree(cvs_tagname);
cvs_tagname = xstrdup(val);
} else if (!strcmp(opt, "umask")) {
- cvs_umask = (int)strtonum(val, 0, INT_MAX, &errstr);
- if (errstr != NULL)
- fatal("cvs_parse_configfile: %s: %s", val,
- errstr);
+ cvs_umask = strtol(val, &ep, 8);
+
+ if (val == ep || *ep != '\0')
+ fatal("cvs_parse_configfile: umask %s is "
+ "invalid", val);
+ if (cvs_umask < 0 || cvs_umask > 07777)
+ fatal("cvs_parse_configfile: umask %s is "
+ "invalid", val);
} else if (!strcmp(opt, "dlimit")) {
if (getrlimit(RLIMIT_DATA, &rl) != -1) {
rl.rlim_cur = (int)strtonum(val, 0, INT_MAX,