From 222bf2cfd60c50abbe338c1e839a43609086829f Mon Sep 17 00:00:00 2001 From: claudio Date: Thu, 9 Jun 2022 17:33:47 +0000 Subject: [PATCH] Properly error out if a variable does not exist. Need to pass back ERROR to yylex() to make the parser fail nicely. OK tb@ --- usr.sbin/bgpd/parse.y | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index dfd00462759..89b5c672d88 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -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 @@ -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) { -- 2.20.1