From 40b227940768f22f3cfd7569be2de2c85c025fd2 Mon Sep 17 00:00:00 2001 From: Eshan Kelkar Date: Tue, 11 Jun 2024 09:44:08 +0530 Subject: [PATCH] match.c: Add check for NULL arguments passed to match_group() This commit also initializes the pointers in match_group() to NULL in order to follow libssh coding guidelines. Signed-off-by: Eshan Kelkar Reviewed-by: Jakub Jelen Reviewed-by: Sahana Prasad --- src/match.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/match.c b/src/match.c index 9e3ce78f..9993b5f2 100644 --- a/src/match.c +++ b/src/match.c @@ -595,8 +595,12 @@ match_cidr_address_list(const char *address, */ int match_group(const char *group, const char *object) { - const char *a; - const char *z; + const char *a = NULL; + const char *z = NULL; + + if (group == NULL || object == NULL) { + return 0; + } z = group; do {