diff options
Diffstat (limited to 'sbin/unwind/uw_parse.y')
-rw-r--r-- | sbin/unwind/uw_parse.y | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/sbin/unwind/uw_parse.y b/sbin/unwind/uw_parse.y index bdda384e7e3..7bc40580581 100644 --- a/sbin/unwind/uw_parse.y +++ b/sbin/unwind/uw_parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: uw_parse.y,v 1.5 2019/01/29 20:03:49 florian Exp $ */ +/* $OpenBSD: uw_parse.y,v 1.6 2019/01/29 21:34:37 benno Exp $ */ /* * Copyright (c) 2018 Florian Obser <florian@openbsd.org> @@ -204,8 +204,12 @@ forwarderoptsl : STRING { if(strlcpy(unwind_forwarder->name, $1, sizeof(unwind_forwarder->name)) >= - sizeof(unwind_forwarder->name)) - err(1, "%s too long", $1); + sizeof(unwind_forwarder->name)) { + free(unwind_forwarder); + yyerror("forwarder %s too long", $1); + free($1); + YYERROR; + } SIMPLEQ_INSERT_TAIL( &conf->unwind_forwarder_list, @@ -216,6 +220,7 @@ forwarderoptsl : STRING { if ($3 <= 0 || $3 > (int)USHRT_MAX) { yyerror("invalid port: %lld", $3); + free($1); YYERROR; } @@ -227,8 +232,12 @@ forwarderoptsl : STRING { sizeof(unwind_forwarder->name), "%s@%d", $1, (int)$3); if (ret == -1 || (size_t)ret >= - sizeof(unwind_forwarder->name)) - err(1, "%s too long", $1); + sizeof(unwind_forwarder->name)) { + free(unwind_forwarder); + yyerror("forwarder %s too long", $1); + free($1); + YYERROR; + } SIMPLEQ_INSERT_TAIL( &conf->unwind_forwarder_list, @@ -241,8 +250,12 @@ forwarderoptsl : STRING { if(strlcpy(unwind_forwarder->name, $1, sizeof(unwind_forwarder->name)) >= - sizeof(unwind_forwarder->name)) - err(1, "%s too long", $1); + sizeof(unwind_forwarder->name)) { + free(unwind_forwarder); + yyerror("forwarder %s too long", $1); + free($1); + YYERROR; + } SIMPLEQ_INSERT_TAIL( &conf->unwind_dot_forwarder_list, @@ -253,6 +266,7 @@ forwarderoptsl : STRING { if ($3 <= 0 || $3 > (int)USHRT_MAX) { yyerror("invalid port: %lld", $3); + free($1); YYERROR; } @@ -264,8 +278,12 @@ forwarderoptsl : STRING { sizeof(unwind_forwarder->name), "%s@%d", $1, (int)$3); if (ret == -1 || (size_t)ret >= - sizeof(unwind_forwarder->name)) - err(1, "%s too long", $1); + sizeof(unwind_forwarder->name)) { + free(unwind_forwarder); + yyerror("forwarder %s too long", $1); + free($1); + YYERROR; + } SIMPLEQ_INSERT_TAIL( &conf->unwind_dot_forwarder_list, |