Properly error out if a variable does not exist. Need to pass back
authorclaudio <claudio@openbsd.org>
Thu, 9 Jun 2022 17:33:47 +0000 (17:33 +0000)
committerclaudio <claudio@openbsd.org>
Thu, 9 Jun 2022 17:33:47 +0000 (17:33 +0000)
ERROR to yylex() to make the parser fail nicely.
OK tb@

usr.sbin/bgpd/parse.y

index dfd0046..89b5c67 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.428 2022/06/02 11:12:47 claudio Exp $ */
+/*     $OpenBSD: parse.y,v 1.429 2022/06/09 17:33:47 claudio Exp $ */
 
 /*
  * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -3248,8 +3248,10 @@ expand_macro(void)
                break;
        }
        val = symget(buf);
-       if (val == NULL)
+       if (val == NULL) {
                yyerror("macro '%s' not defined", buf);
+               return (ERROR);
+       }
        p = val + strlen(val) - 1;
        lungetc(DONE_EXPAND);
        while (p >= val) {