From 2f3ddeccc57f36489c5f3e8f0045f0266639dae2 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Mon, 13 Oct 2014 15:57:34 +0100 Subject: [PATCH] Properly trim whitespaces from the hashbang CGI interpreter path --- mongoose.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mongoose.c b/mongoose.c index 76048b28..a7b1a34c 100644 --- a/mongoose.c +++ b/mongoose.c @@ -1964,7 +1964,7 @@ static process_id_t start_process(char *interp, const char *cmd, buf[sizeof(buf) - 1] = '\0'; if (buf[0] == '#' && buf[1] == '!') { interp = buf + 2; - for (p = interp + strlen(interp); + for (p = interp + strlen(interp) - 1; isspace(* (uint8_t *) p) && p > interp; p--) *p = '\0'; } fclose(fp);