diff options
author | benno <benno@openbsd.org> | 2016-06-21 21:35:24 +0000 |
---|---|---|
committer | benno <benno@openbsd.org> | 2016-06-21 21:35:24 +0000 |
commit | 0c7b4ca6ee98f27c9efdfffb3fb9399787634128 (patch) | |
tree | 984fb44c72b029d42c34d3742398657cf6b2bd26 /usr.sbin/dvmrpd | |
parent | Make usage string match the man page. (diff) | |
download | wireguard-openbsd-0c7b4ca6ee98f27c9efdfffb3fb9399787634128.tar.xz wireguard-openbsd-0c7b4ca6ee98f27c9efdfffb3fb9399787634128.zip |
do not allow whitespace in macro names, i.e. "this is" = "a variable".
change this in all config parsers in our tree that support macros.
problem reported by sven falempin.
feedback from henning@, stsp@, deraadt@
ok florian@ mikeb@
Diffstat (limited to 'usr.sbin/dvmrpd')
-rw-r--r-- | usr.sbin/dvmrpd/parse.y | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.sbin/dvmrpd/parse.y b/usr.sbin/dvmrpd/parse.y index 66b7b73d157..e78843fec8f 100644 --- a/usr.sbin/dvmrpd/parse.y +++ b/usr.sbin/dvmrpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.29 2014/11/20 05:51:20 jsg Exp $ */ +/* $OpenBSD: parse.y,v 1.30 2016/06/21 21:35:24 benno Exp $ */ /* * Copyright (c) 2004, 2005, 2006 Esben Norby <norby@openbsd.org> @@ -163,8 +163,16 @@ yesno : STRING { ; varset : STRING '=' string { + char *s = $1; if (conf->opts & DVMRPD_OPT_VERBOSE) printf("%s = \"%s\"\n", $1, $3); + while (*s++) { + if (isspace((unsigned char)*s)) { + yyerror("macro name cannot contain " + "whitespace"); + YYERROR; + } + } if (symset($1, $3, 0) == -1) fatal("cannot store variable"); free($1); |