From 1edcc33af20f7279ad2ce5d551f7d6c779067132 Mon Sep 17 00:00:00 2001 From: Tobias Stoeckmann Date: Mon, 18 Dec 2023 10:09:24 +0100 Subject: conf/pam_conv1: check strdup results The strdup function my fail. Check its return value and handle the failure accordingly. Co-authored-by: Benny Baumann Signed-off-by: Tobias Stoeckmann --- conf/pam_conv1/pam_conv_y.y | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'conf') diff --git a/conf/pam_conv1/pam_conv_y.y b/conf/pam_conv1/pam_conv_y.y index 365d86f3..94a22a44 100644 --- a/conf/pam_conv1/pam_conv_y.y +++ b/conf/pam_conv1/pam_conv_y.y @@ -158,11 +158,19 @@ path : TOK { /* XXX - this could be used to check if file present */ $$ = strdup(yytext); + if ($$ == NULL) { + yyerror("failed to duplicate path"); + exit(1); + } } tok : TOK { $$ = strdup(yytext); + if ($$ == NULL) { + yyerror("failed to duplicate token"); + exit(1); + } } %% -- cgit v1.2.3