diff --git a/src/extra-tools/execl-envfile.c b/src/extra-tools/execl-envfile.c index f9f4b49937821736651b309bda74c0346171aa4a..169e41f2364ce89352842ab60eb2fd9edb036e47 100644 --- a/src/extra-tools/execl-envfile.c +++ b/src/extra-tools/execl-envfile.c @@ -15,7 +15,7 @@ #include <stdlib.h> #include <sys/stat.h> #include <unistd.h> -#include <stdio.h> +//#include <stdio.h> #include <oblibs/string.h> #include <oblibs/stralist.h> @@ -169,23 +169,26 @@ int main (int argc, char const *const *argv, char const *const *envp) xpathexec_run(argv[0],argv,envp) ; } } + if (!file_readputsa(&src,path,file)) strerr_diefu4sys(111,"read file: ",path,"/",file) ; if (!env_parsenclean(&modifs,&src)) strerr_diefu4x(111,"parse and clean environment of: ",path,"/",file) ; if (!env_split(&GAENV,&SAENV,&src)) strerr_diefu4x(111,"split environment of: ",path,"/",file) ; + if (genalloc_len(diuint32,&GAENV) > MAXVAR) strerr_dief4x(111,"to many variables in file: ",path,"/",file) ; } else { for (i = 0 ; i < genalloc_len(stralist,&toparse) ; i++) { src.len = 0 ; - size_t n = i + MAXVAR ; + size_t n = genalloc_len(diuint32,&GAENV) + MAXVAR ; if (i > MAXFILE) strerr_dief2x(111,"to many file to parse in: ",path) ; if (!file_readputsa(&src,path,gaistr(&toparse,i))) strerr_diefu4sys(111,"read file: ",path,"/",gaistr(&toparse,i)) ; if (!env_parsenclean(&modifs,&src)) strerr_diefu4x(111,"parse and clean environment of: ",path,"/",gaistr(&toparse,i)) ; if (!env_split(&GAENV,&SAENV,&src)) strerr_diefu4x(111,"split environment of: ",path,"/",gaistr(&toparse,i)) ; - if (genalloc_len(stralist,&toparse) > n) strerr_dief4x(111,"to many variables in file: ",path,"/",gaistr(&toparse,i)) ; + if (genalloc_len(diuint32,&GAENV) > n) strerr_dief4x(111,"to many variables in file: ",path,"/",gaistr(&toparse,i)) ; } } + genalloc_deepfree(stralist,&toparse,stra_free) ; stralloc_free(&src) ; diff --git a/src/lib66/environ.c b/src/lib66/environ.c index 7eacd0994f2b451013523d203094a8433e2fb58e..9ec7b997e4e24328959e8f126178c5ae77a02bb4 100644 --- a/src/lib66/environ.c +++ b/src/lib66/environ.c @@ -111,7 +111,6 @@ int env_split_one(char *line,genalloc *ga,stralloc *sa) diuint32 tmp = DIUINT32_ZERO ; k = line ; v = line ; - obstr_sep(&v,"=") ; if (v == NULL) return 0 ; @@ -141,7 +140,7 @@ int env_split(genalloc *gaenv,stralloc *saenv,stralloc *src) /** skip commented line or empty line*/ if (env_clean(&tmp) < 0) continue ; if (*line) - if (!env_split_one(line,gaenv,saenv)) goto err ; + if (!env_split_one(tmp.s,gaenv,saenv)) goto err ; } genalloc_deepfree(stralist,&gatmp,stra_free) ; stralloc_free(&tmp) ;