- Memleaks in xpath parse error

- Static linkage cli fix (worked in 5.3.0 but restructuring broke it)
- Renamed all cligen_ph_active_get to cligen_pt_active_get
- Added AFL deferred init
- test_install.sh for static .a suffix
This commit is contained in:
Olof hagsand 2021-10-03 18:33:06 +02:00
parent d175720b7e
commit 42e61f461c
11 changed files with 59 additions and 41 deletions

View file

@ -51,8 +51,9 @@ SH_SUFFIX = @SH_SUFFIX@
LIBSTATIC_SUFFIX = @LIBSTATIC_SUFFIX@
INSTALLFLAGS = @INSTALLFLAGS@
LDFLAGS = @LDFLAGS@
ifeq ($(LINKAGE),dynamic)
LDFLAGS += -rdynamic -L. # -rdynamic for using -ldl
ifneq ($(LINKAGE),dynamic)
# -rdynamic for using -ldl
LDFLAGS += -rdynamic
endif
prefix = @prefix@
@ -179,13 +180,19 @@ test: $(MYLIBSTATIC)
endif
$(CC) $(INCLUDES) $(LDFLAGS) -L . $^ $(LIBS) -o $@
# Note1: static linking of clixon_cli must have:
# 1) -rdynamic
# 2) $(APPOBJ)
# Note2: LIBDEPS is just a mechanism to ensure libclixon.so is built
$(APPL): $(APPOBJ) $(LIBDEPS)
ifeq ($(LINKAGE),dynamic)
$(APPL): $(MYLIBDYNAMIC)
echo "LIBS:$(LIBS)"
$(CC) $(LDFLAGS) $(APPOBJ) $(EXTRAS) $(CLIGEN_LIB) $(LIBS) -L. $< -o $@
else
$(APPL): $(MYLIBSTATIC)
$(APPL): $(LIBOBJ)
$(CC) $(LDFLAGS) $(APPOBJ) $(EXTRAS) $(LIBOBJ) $(CLIGEN_LIB) $(LIBS) -o $@
endif
$(APPL): $(APPOBJ) $(LIBDEPS)
$(CC) $(LDFLAGS) $(EXTRAS) -L. $^ $(CLIGEN_LIB) $(LIBS) -o $@
$(MYLIBDYNAMIC) : $(LIBOBJ) $(LIBDEPS)
ifeq ($(HOST_VENDOR),apple)

View file

@ -1310,7 +1310,7 @@ cli_help(clicon_handle h, cvec *vars, cvec *argv)
cligen_handle ch = cli_cligen(h);
parse_tree *pt;
pt = cligen_ph_active_get(ch);
pt = cligen_pt_active_get(ch);
return cligen_help(ch, stdout, pt);
}

View file

@ -575,6 +575,10 @@ main(int argc,
argc -= optind;
argv += optind;
#ifdef __AFL_HAVE_MANUAL_CONTROL
__AFL_INIT();
#endif
/* Access the remaining argv/argc options (after --) w clicon-argv_get() */
clicon_argv_set(h, argv0, argc, argv);
@ -754,8 +758,9 @@ main(int argc,
}
/* Go into event-loop unless -1 command-line */
if (!once)
if (!once){
retval = cli_interactive(h);
}
else
retval = 0;
done:

View file

@ -523,8 +523,10 @@ cli_handler_err(FILE *f)
}
/*! Evaluate a matched command
* @param[in] h Clicon handle
* @param[in] cmd The command string
* @param[in] h Clicon handle
* @param[in] cmd The command string
* @param[in] match_obj
* @param[in] cvv
* @retval int If there is a callback, the return value of the callback is returned,
* @retval 0 otherwise
*/
@ -603,13 +605,13 @@ clicon_parse(clicon_handle h,
}
if (csm != NULL){
modename0 = NULL;
if ((pt = cligen_ph_active_get(cli_cligen(h))) != NULL)
if ((pt = cligen_pt_active_get(cli_cligen(h))) != NULL)
modename0 = pt_name_get(pt);
if (cligen_ph_active_set(cli_cligen(h), modename) < 0){
fprintf(stderr, "No such parse-tree registered: %s\n", modename);
goto done;
}
if ((pt = cligen_ph_active_get(cli_cligen(h))) == NULL){
if ((pt = cligen_pt_active_get(cli_cligen(h))) == NULL){
fprintf(stderr, "No such parse-tree registered: %s\n", modename);
goto done;
}