diff options
author | Sebastian Benoit <benno@cvs.openbsd.org> | 2016-06-21 21:35:26 +0000 |
---|---|---|
committer | Sebastian Benoit <benno@cvs.openbsd.org> | 2016-06-21 21:35:26 +0000 |
commit | f2ada2db1464df13335d236529c834c378ced993 (patch) | |
tree | a15cd06b17ca32de9b75238620437773f018ecdf /usr.sbin/ldpd | |
parent | 05fc6735d59f44db060a9d3a428944db3e862ebe (diff) |
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/ldpd')
-rw-r--r-- | usr.sbin/ldpd/parse.y | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.sbin/ldpd/parse.y b/usr.sbin/ldpd/parse.y index d332b9ea7f1..4ba0249eaa0 100644 --- a/usr.sbin/ldpd/parse.y +++ b/usr.sbin/ldpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.55 2016/06/18 01:33:02 renato Exp $ */ +/* $OpenBSD: parse.y,v 1.56 2016/06/21 21:35:24 benno Exp $ */ /* * Copyright (c) 2013, 2015, 2016 Renato Westphal <renato@openbsd.org> @@ -208,8 +208,16 @@ pw_type : ETHERNET { $$ = PW_TYPE_ETHERNET; } ; varset : STRING '=' string { + char *s = $1; if (global.cmd_opts & LDPD_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); |