Welcome! Log In Create A New Profile

Advanced

[nginx] Removed extra allocation for r->uri.

Maxim Dounin
December 10, 2020 12:14PM
details: https://hg.nginx.org/nginx/rev/2fec22332ff4
branches:
changeset: 7753:2fec22332ff4
user: Maxim Dounin <mdounin@mdounin.ru>
date: Thu Dec 10 20:09:39 2020 +0300
description:
Removed extra allocation for r->uri.

The ngx_http_parse_complex_uri() function cannot make URI longer and does
not null-terminate URI, so there is no need to allocate an extra byte. This
allocation appears to be a leftover from changes in 461:a88a3e4e158f (0.1.5),
where null-termination of r->uri and many other strings was removed.

diffstat:

src/http/ngx_http_request.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 8989fbd2f89a -r 2fec22332ff4 src/http/ngx_http_request.c
--- a/src/http/ngx_http_request.c Thu Dec 10 20:09:30 2020 +0300
+++ b/src/http/ngx_http_request.c Thu Dec 10 20:09:39 2020 +0300
@@ -1230,7 +1230,7 @@ ngx_http_process_request_uri(ngx_http_re
r->uri.len++;
}

- r->uri.data = ngx_pnalloc(r->pool, r->uri.len + 1);
+ r->uri.data = ngx_pnalloc(r->pool, r->uri.len);
if (r->uri.data == NULL) {
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
return NGX_ERROR;
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Removed extra allocation for r->uri.

Maxim Dounin 292 December 10, 2020 12:14PM



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

Online Users

Guests: 309
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