From 391adcc526d8e3f7ea3514bd4f1909d70ea6ef0c Mon Sep 17 00:00:00 2001 From: Marcelo Araujo Date: Mon, 11 Jul 2016 03:34:32 +0000 Subject: [PATCH] Do not allow whitespace in macro names. Obtained from: OpenBSD (r1.19). --- usr.sbin/ypldap/parse.y | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/usr.sbin/ypldap/parse.y b/usr.sbin/ypldap/parse.y index 15d3ff202320..b97af1dfa801 100644 --- a/usr.sbin/ypldap/parse.y +++ b/usr.sbin/ypldap/parse.y @@ -144,6 +144,14 @@ include : INCLUDE STRING { ; varset : STRING '=' STRING { + char *s = $1; + 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);