diff --git a/lib/src/clixon_xpath_eval.c b/lib/src/clixon_xpath_eval.c index d02c4a01..a5682cda 100644 --- a/lib/src/clixon_xpath_eval.c +++ b/lib/src/clixon_xpath_eval.c @@ -708,6 +708,10 @@ xp_relop(xp_ctx *xc1, int reverse = 0; double n1, n2; + if (xc1 == NULL || xc2 == NULL){ + clicon_err(OE_UNIX, EINVAL, "xc1 or xc2 NULL"); + goto done; + } if ((xr = malloc(sizeof(*xr))) == NULL){ clicon_err(OE_UNIX, errno, "malloc"); goto done; diff --git a/test/test_netconf.sh b/test/test_netconf.sh index 6339b0bc..d05e22c7 100755 --- a/test/test_netconf.sh +++ b/test/test_netconf.sh @@ -295,6 +295,13 @@ expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOe0e1]]>]]>" "^applicationunknown-elementnameerrorFailed to find YANG spec of XML node: name with parent: name in namespace: urn:ietf:params:xml:ns:yang:ietf-interfaces]]>]]>$" +# Negative tests +new "netconf xpath syntax error (api-path not xpath) should fail" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationoperation-failederrorxpath parser on line 1: syntax error at or before: ',']]>]]>$" + +new "netconf wrong xpath should fail" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" + if [ $BE -ne 0 ]; then new "Kill backend" # Check if premature kill