Skip to content

Commit 66800cf

Browse files
committed
Use a string copy
1 parent 6c0b4ea commit 66800cf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cgi/mapcache.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ static void set_headers(mapcache_context* ctx, char** env)
236236
// add all environ settings including HTTP headers to
237237
// a ctx->headers_in apr_table_t
238238

239-
char* key, * val, * kvp, * pair;
239+
char * key, * val, * kvp, * pair;
240240
int i;
241241
int num_env_var;
242242
apr_table_t* headers;
@@ -253,7 +253,8 @@ static void set_headers(mapcache_context* ctx, char** env)
253253
// convert HTTP header keys from the form HTTP_MY_HEADER to MY-HEADER
254254
key = apr_strtok(kvp, "=", &pair);
255255
key = mapcache_util_str_replace(ctx->pool, key, "HTTP_", "");
256-
key = mapcache_util_str_replace_all(ctx->pool, key, "_", "-");
256+
key = mapcache_util_str_replace_all(ctx->pool, apr_pstrdup(ctx->pool, key), "_", "-");
257+
257258
val = apr_strtok(NULL, "=", &pair);
258259

259260
if (val != NULL) {

0 commit comments

Comments
 (0)