mirror of
https://git.zx2c4.com/cgit
synced 2024-11-22 16:38:42 +00:00
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:
parent
996f86e664
commit
3a84324379
4
cgit.c
4
cgit.c
@ -401,9 +401,9 @@ static void prepare_context(struct cgit_context *ctx)
|
|||||||
ctx->page.etag = NULL;
|
ctx->page.etag = NULL;
|
||||||
memset(&ctx->cfg.mimetypes, 0, sizeof(struct string_list));
|
memset(&ctx->cfg.mimetypes, 0, sizeof(struct string_list));
|
||||||
if (ctx->env.script_name)
|
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)
|
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)
|
if (!ctx->env.cgit_config)
|
||||||
ctx->env.cgit_config = CGIT_CONFIG;
|
ctx->env.cgit_config = CGIT_CONFIG;
|
||||||
}
|
}
|
||||||
|
20
cgit.h
20
cgit.h
@ -255,16 +255,16 @@ struct cgit_page {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct cgit_environment {
|
struct cgit_environment {
|
||||||
char *cgit_config;
|
const char *cgit_config;
|
||||||
char *http_host;
|
const char *http_host;
|
||||||
char *https;
|
const char *https;
|
||||||
char *no_http;
|
const char *no_http;
|
||||||
char *path_info;
|
const char *path_info;
|
||||||
char *query_string;
|
const char *query_string;
|
||||||
char *request_method;
|
const char *request_method;
|
||||||
char *script_name;
|
const char *script_name;
|
||||||
char *server_name;
|
const char *server_name;
|
||||||
char *server_port;
|
const char *server_port;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cgit_context {
|
struct cgit_context {
|
||||||
|
Loading…
Reference in New Issue
Block a user