summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/cfgfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'VNFs/DPPD-PROX/cfgfile.c')
-rw-r--r--VNFs/DPPD-PROX/cfgfile.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/VNFs/DPPD-PROX/cfgfile.c b/VNFs/DPPD-PROX/cfgfile.c
index 0c5950e4..2bc9e5f1 100644
--- a/VNFs/DPPD-PROX/cfgfile.c
+++ b/VNFs/DPPD-PROX/cfgfile.c
@@ -26,6 +26,7 @@
#include "parse_utils.h"
#include "log.h"
#include "quit.h"
+#include "prox_compat.h"
#define UINT32_MAX_STR "4294967295"
@@ -191,10 +192,11 @@ static struct cfg_section *cfg_check_section(char *buffer, struct cfg_section *p
/* only numeric characters are valid for section index */
char val[MAX_CFG_STRING_LEN];
- if (pend[0] == '$')
- parse_single_var(val, sizeof(val), pend);
- else
- strncpy(val, pend, sizeof(val));
+ if (pend[0] == '$') {
+ if (parse_vars(val, sizeof(val), pend))
+ return NULL;
+ } else
+ prox_strncpy(val, pend, sizeof(val));
for (len = 0; val[len] != '\0'; ++len) {
if (strchr(valid, val[len]) == NULL) {
@@ -272,9 +274,14 @@ int cfg_parse(struct cfg_file *pcfg, struct cfg_section *psec)
do {
ret = fgets(buffer, sizeof(buffer), pcfg->pfile);
+ /* remove comments */
+ if (*ret == ';') {
+ *ret = '\0';
+ }
+
if (ret && *ret != '[') {
size_t l = strlen(buffer);
- strncpy(lines, buffer, max_len);
+ prox_strncpy(lines, buffer, max_len);
max_len -= l;
lines += l;
}
@@ -298,7 +305,7 @@ int cfg_parse(struct cfg_file *pcfg, struct cfg_section *psec)
}
while (cfg_get_line(pcfg, buffer, MAX_CFG_STRING_LEN, psec->raw_lines) > 0) {
- strncpy(pcfg->cur_line, buffer, sizeof(pcfg->cur_line));
+ prox_strncpy(pcfg->cur_line, buffer, sizeof(pcfg->cur_line));
if (*buffer == '[') {
if (index_count + 1 < psec->nbindex) {
// Need to loop - go back to recorded postion in file