* Fixed: [Double free when using libxml2 as regex engine #117](https://github.com/clicon/clixon/issues/117)
* added libxml2 support in test_pattern.sh when libxml2 is configured
This commit is contained in:
parent
eda4a58ebf
commit
99b01040a7
7 changed files with 29 additions and 10 deletions
|
|
@ -87,6 +87,7 @@ Expected: July 2020
|
|||
|
||||
### Corrected Bugs
|
||||
|
||||
* Fixed: [Double free when using libxml2 as regex engine #117](https://github.com/clicon/clixon/issues/117)
|
||||
* Fixed: Reading in a yang-spec file exactly the same size as the buffer (1024/2048/4096/...) could leave the buffer not terminated with a 0 byte
|
||||
* Fixed: The module `clixon-rfc5277` was always enabled, but should only be enabled when `CLICON_STREAM_DISCOVERY_RFC5277` is enabled.
|
||||
|
||||
|
|
|
|||
2
configure
vendored
2
configure
vendored
|
|
@ -637,6 +637,7 @@ CPP
|
|||
wwwuser
|
||||
wwwdir
|
||||
enable_optyangs
|
||||
with_libxml2
|
||||
with_restconf
|
||||
SH_SUFFIX
|
||||
CLIXON_DEFAULT_CONFIG
|
||||
|
|
@ -3350,6 +3351,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
|
|||
|
||||
# If yes, compile apps/restconf
|
||||
|
||||
|
||||
wwwdir=/www-data
|
||||
|
||||
wwwuser=www-data
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ AC_SUBST(CLIXON_DEFAULT_CONFIG)
|
|||
AC_SUBST(LIBS)
|
||||
AC_SUBST(SH_SUFFIX)
|
||||
AC_SUBST(with_restconf) # If yes, compile apps/restconf
|
||||
AC_SUBST(with_libxml2)
|
||||
AC_SUBST(enable_optyangs)
|
||||
AC_SUBST(wwwdir,/www-data)
|
||||
AC_SUBST(wwwuser,www-data)
|
||||
|
|
|
|||
|
|
@ -984,7 +984,9 @@ xml_yang_validate_add(clicon_handle h,
|
|||
goto fail;
|
||||
}
|
||||
}
|
||||
if ((ys_cv_validate(h, cv, yt, &reason)) != 1){
|
||||
if ((ret = ys_cv_validate(h, cv, yt, &reason)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
if (netconf_bad_element_xml(xret, "application", yang_argument_get(yt), reason) < 0)
|
||||
goto done;
|
||||
goto fail;
|
||||
|
|
|
|||
|
|
@ -2827,17 +2827,22 @@ yang_type_cache_free(yang_type_cache *ycache)
|
|||
switch (ycache->yc_rxmode){
|
||||
case REGEXP_POSIX:
|
||||
cligen_regex_posix_free(cv_void_get(cv));
|
||||
if ((p = cv_void_get(cv)) != NULL){
|
||||
free(p);
|
||||
cv_void_set(cv, NULL);
|
||||
}
|
||||
break;
|
||||
case REGEXP_LIBXML2:
|
||||
cligen_regex_libxml2_free(cv_void_get(cv));
|
||||
/* Note, already freed in libxml2 case */
|
||||
if ((p = cv_void_get(cv)) != NULL){
|
||||
cv_void_set(cv, NULL);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if ((p = cv_void_get(cv)) != NULL){
|
||||
free(p);
|
||||
cv_void_set(cv, NULL);
|
||||
}
|
||||
|
||||
}
|
||||
cvec_free(ycache->yc_regexps);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
# Generated from autotools
|
||||
|
||||
WITH_RESTCONF=@with_restconf@
|
||||
WITH_RESTCONF=@with_restconf@ # evhtp, fcgi or ""
|
||||
WITH_LIBXML2=@with_libxml2@ # yes or ""
|
||||
CXX=@CXX@
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
# Test strings have been generated by:
|
||||
# https://www.browserling.com/tools/text-from-regex
|
||||
# This is an unit test, not a clixon system test
|
||||
# See test_regexp.sh for unit regexp tests
|
||||
#
|
||||
# NOTE: no tests for ' quote in strings
|
||||
# NOTE, the following does not match in libxml2 (but in clixon):
|
||||
|
|
@ -22,9 +21,15 @@ APPNAME=example
|
|||
cfg=$dir/pattern.xml
|
||||
fyang=$dir/pattern.yang
|
||||
|
||||
# Regexp mode: posix or libxml2
|
||||
: ${regex:=posix}
|
||||
|
||||
regexlist="posix"
|
||||
if [ "${WITH_LIBXML2}" = yes ] ; then
|
||||
regexlist="$regexlist libxml2"
|
||||
fi
|
||||
# Loop over supported regexps. Always run posix, run libxml2 if configured
|
||||
for regex in $regexlist; do
|
||||
new "pattern tests for regex:$regex"
|
||||
|
||||
cat <<EOF > $cfg
|
||||
<clixon-config xmlns="http://clicon.org/config">
|
||||
<CLICON_CONFIGFILE>$cfg</CLICON_CONFIGFILE>
|
||||
|
|
@ -720,7 +725,6 @@ testrun "p$pnr" 0 '<![CDATA01234567890]]>'
|
|||
#testrun "p$pnr" 0 '<![CDATA[0123456789]]' # XML parse error
|
||||
|
||||
# CLI tests
|
||||
|
||||
new "CLI tests for RFC7950 Sec 9.4.7 ex 2 AB"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c rfc2 AB" 0 '^$'
|
||||
|
||||
|
|
@ -797,6 +801,8 @@ if [ $BE -ne 0 ]; then
|
|||
sudo pkill -u root -f clixon_backend
|
||||
fi
|
||||
|
||||
done # regex
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
# unset conditional parameters
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue