From c156832234c75a9db1907ed997ccb3d0e32035b8 Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Sat, 26 Jan 2019 18:48:56 +0100 Subject: [PATCH] fixed segv with unmatched restconf keys in uri --- apps/restconf/restconf_methods.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/restconf/restconf_methods.c b/apps/restconf/restconf_methods.c index 27512442..5795ee07 100644 --- a/apps/restconf/restconf_methods.c +++ b/apps/restconf/restconf_methods.c @@ -643,18 +643,19 @@ match_list_keys(yang_stmt *y, char *keyd; if (y->ys_keyword != Y_LIST &&y->ys_keyword != Y_LEAF_LIST) - return -1; + goto done; cvk = y->ys_cvec; /* Use Y_LIST cache, see ys_populate_list() */ cvi = NULL; while ((cvi = cvec_each(cvk, cvi)) != NULL) { keyname = cv_string_get(cvi); if ((xkeya = xml_find(xapipath, keyname)) == NULL) goto done; /* No key in api-path */ - - keya = xml_body(xkeya); + if ((keya = xml_body(xkeya)) == NULL) + goto done; if ((xkeyd = xml_find(xdata, keyname)) == NULL) goto done; /* No key in data */ - keyd = xml_body(xkeyd); + if ((keyd = xml_body(xkeyd)) == NULL) + goto done; if (strcmp(keya, keyd) != 0) goto done; /* keys dont match */ }