Welcome! Log In Create A New Profile

Advanced

[nginx] Xslt: fixed potential buffer overflow with null character.

Maxim Dounin
July 18, 2019 11:30AM
details: https://hg.nginx.org/nginx/rev/9a970c905045
branches:
changeset: 7540:9a970c905045
user: Maxim Dounin <mdounin@mdounin.ru>
date: Thu Jul 18 18:27:54 2019 +0300
description:
Xslt: fixed potential buffer overflow with null character.

Due to shortcomings of the ccv->zero flag implementation in complex value
interface, length of the resulting string from ngx_http_complex_value()
might either not include terminating null character or include it,
so the only safe way to work with the result is to use it as a
null-terminated string.

Reported by Patrick Wollgast.

diffstat:

src/http/modules/ngx_http_xslt_filter_module.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)

diffs (30 lines):

diff --git a/src/http/modules/ngx_http_xslt_filter_module.c b/src/http/modules/ngx_http_xslt_filter_module.c
--- a/src/http/modules/ngx_http_xslt_filter_module.c
+++ b/src/http/modules/ngx_http_xslt_filter_module.c
@@ -628,7 +628,7 @@ static ngx_int_t
ngx_http_xslt_params(ngx_http_request_t *r, ngx_http_xslt_filter_ctx_t *ctx,
ngx_array_t *params, ngx_uint_t final)
{
- u_char *p, *last, *value, *dst, *src, **s;
+ u_char *p, *value, *dst, *src, **s;
size_t len;
ngx_uint_t i;
ngx_str_t string;
@@ -698,8 +698,6 @@ ngx_http_xslt_params(ngx_http_request_t
ngx_memcpy(p, string.data, string.len + 1);
}

- last = p + string.len;
-
while (p && *p) {

value = p;
@@ -729,7 +727,7 @@ ngx_http_xslt_params(ngx_http_request_t
*p++ = '\0';

} else {
- len = last - value;
+ len = ngx_strlen(value);
}

ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Xslt: fixed potential buffer overflow with null character.

Maxim Dounin 279 July 18, 2019 11:30AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 316
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready