Fixed: SEGV when using NETCONF get filter xpath and non-existent key

* eg `select="/ex:table[ex:non-exist='a']`
This commit is contained in:
Olof hagsand 2022-11-01 11:13:40 +01:00
parent 56f4bb45cc
commit e3d621c66d
3 changed files with 18 additions and 4 deletions

View file

@ -845,10 +845,18 @@ xp_relop(xp_ctx *xc1,
case XO_EQ:
if (s1 == NULL && s2 == NULL)
xr->xc_bool = 1;
else if (s1 == NULL && strlen(s2) == 0)
xr->xc_bool = 1;
else if (strlen(s1) == 0 && s2 == NULL)
xr->xc_bool = 1;
if (s1 == NULL){
if (strlen(s2) == 0)
xr->xc_bool = 1;
else
xr->xc_bool = 0;
}
else if (s2 == NULL){
if (strlen(s1) == 0)
xr->xc_bool = 1;
else
xr->xc_bool = 0;
}
else
xr->xc_bool = (strcmp(s1, s2)==0);
break;