From bdfd0def8d6b4b1580418d32b97e1539d9b52723 Mon Sep 17 00:00:00 2001 From: "Oleg A. Mamontov" Date: Sun, 25 Nov 2018 03:01:47 +0300 Subject: [PATCH] bugfix: ngx_http_lua_gen_chunk_name should take into account full file name instead of last path component --- src/ngx_http_lua_directive.c | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/src/ngx_http_lua_directive.c b/src/ngx_http_lua_directive.c index fb8c6dc5bf..c7937bd354 100644 --- a/src/ngx_http_lua_directive.c +++ b/src/ngx_http_lua_directive.c @@ -1276,7 +1276,7 @@ static u_char * ngx_http_lua_gen_chunk_name(ngx_conf_t *cf, const char *tag, size_t tag_len, size_t *chunkname_len) { - u_char *p, *out; + u_char *out; size_t len; len = sizeof("=(:)") - 1 + tag_len + cf->conf_file->file.name.len @@ -1287,27 +1287,10 @@ ngx_http_lua_gen_chunk_name(ngx_conf_t *cf, const char *tag, size_t tag_len, return NULL; } - if (cf->conf_file->file.name.len) { - p = cf->conf_file->file.name.data + cf->conf_file->file.name.len; - while (--p >= cf->conf_file->file.name.data) { - if (*p == '/' || *p == '\\') { - p++; - goto found; - } - } - - p++; - - } else { - p = cf->conf_file->file.name.data; - } - -found: - ngx_snprintf(out, len, "=%*s(%*s:%d)%Z", - tag_len, tag, cf->conf_file->file.name.data - + cf->conf_file->file.name.len - p, - p, cf->conf_file->line); + tag_len, tag, cf->conf_file->file.name.len, + cf->conf_file->file.name.data, + cf->conf_file->line); *chunkname_len = len; return out;