From 198f362e320ac36fa16f2544e295d847aedf3122 Mon Sep 17 00:00:00 2001 From: bapt Date: Wed, 7 Oct 2015 08:56:01 +0000 Subject: Trim spaces at the end of the buffer before trying to convert it to an oid This allows to write entries in sysctl.conf with spaces before the '=' like kern.ipc.shmmax = 9663676416 MFC after: 1 week Sponsored by: Gandi.net --- sbin/sysctl/sysctl.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sbin') diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index d740778c..8d67644 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -262,6 +262,12 @@ parse(const char *string, int lineno) newvalstr = cp; newsize = strlen(cp); } + /* Trim spaces */ + cp = bufp + strlen(bufp) - 1; + while (cp >= bufp && isspace((int)*cp)) { + *cp = '\0'; + cp--; + } len = name2oid(bufp, mib); if (len < 0) { -- cgit v1.1