diff options
-rw-r--r-- | listbas.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -140,10 +140,12 @@ void parse_args(int argc, char **argv, int from_env) { } } +#define ENV_MAX_ARGS 64 + /* make a fake argv and argc */ void parse_env_args(void) { int fargc; - char *fargv[10]; + char *fargv[ENV_MAX_ARGS + 1]; char *env, *p; env = getenv(ENV_OPTS); @@ -159,6 +161,10 @@ void parse_env_args(void) { for(p = env; *p; p++) { if(*p == ' ' || *p == '\t') { *p = '\0'; + if(fargc == ENV_MAX_ARGS) { + fprintf(stderr, "%s: too many spaces in LISTBAS_OPTS (max %d)\n", self, ENV_MAX_ARGS - 1); + break; + } fargv[fargc++] = p + 1; } } |