From 3e98cecd56165e07211f5213fb020ea2513df198 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Mon, 26 Oct 2020 23:27:44 +0100 Subject: [PATCH] enable paths with spaces for finding 'spinit' --- src/frontend/cpitf.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/frontend/cpitf.c b/src/frontend/cpitf.c index f4d984097..b7247e010 100644 --- a/src/frontend/cpitf.c +++ b/src/frontend/cpitf.c @@ -271,9 +271,15 @@ ft_cpinit(void) /* jump over leading spaces */ for (copys = s = cp_tildexpand(Lib_Path); copys && *copys; ) { s = skip_ws(s); - /* copy s into buf until space is seen, r is the actual position */ - for (r = buf; *s && !isspace_c(*s); r++, s++) + /* copy s into buf until end of s, r is the actual position in buf */ + int ii; + for (r = buf, ii = 0; *s; r++, s++, ii++) { *r = *s; + if (ii > 500) { + fprintf(stderr, "Warning: spinit path is too long.\n"); + break; + } + } tfree(copys); /* add a path separator to buf at actual position */ (void) strcpy(r, DIR_PATHSEP); @@ -284,6 +290,7 @@ ft_cpinit(void) /* add "spinit" to buf after actual position */ (void) strcat(r, "spinit"); #endif + if ((fp = fopen(buf, "r")) != NULL) { cp_interactive = FALSE;