Maŕk cgit_environment members const

These reflect the values of environment variables and should never be
changed. Add another xstrdup() when we assign environment variables to
strings that are potentially non-constant.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
This commit is contained in:
Lukas Fleischer
2013-04-01 17:11:14 +02:00
committed by Jason A. Donenfeld
parent 996f86e664
commit 3a84324379
2 changed files with 12 additions and 12 deletions

4
cgit.c
View File

@ -401,9 +401,9 @@ static void prepare_context(struct cgit_context *ctx)
ctx->page.etag = NULL;
memset(&ctx->cfg.mimetypes, 0, sizeof(struct string_list));
if (ctx->env.script_name)
ctx->cfg.script_name = ctx->env.script_name;
ctx->cfg.script_name = xstrdup(ctx->env.script_name);
if (ctx->env.query_string)
ctx->qry.raw = ctx->env.query_string;
ctx->qry.raw = xstrdup(ctx->env.query_string);
if (!ctx->env.cgit_config)
ctx->env.cgit_config = CGIT_CONFIG;
}