summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_sockaddr.c
diff options
context:
space:
mode:
authorOisin Canty <o.canty@f5.com>2021-07-02 10:55:13 +0000
committerOisin Canty <o.canty@f5.com>2021-07-02 10:55:13 +0000
commit7d2bc04e391f9216fb4e0464cb43c9c438f7e034 (patch)
tree60c69b5c3132f2fb1601f11b809f86b1bcbf6a93 /src/nxt_sockaddr.c
parent54bf3e19122ca89ef79abe9cbdd2a039c7d6db3b (diff)
downloadunit-7d2bc04e391f9216fb4e0464cb43c9c438f7e034.tar.gz
unit-7d2bc04e391f9216fb4e0464cb43c9c438f7e034.tar.bz2
Fixing crash during IPv6 text address generation.
When the textual representation of an IPv6 nxt_sockaddr_t was being generated, a crash would occur if the address had a full IPv6 form: f607:7403:1e4b:6c66:33b2:843f:2517:da27 This was caused by a variable that tracks the location of a collapsed group ("::") that was not set to a sane default. When the address was generated, a group would be inserted when it was not necessary, thus causing an overflow. This closes #481 issue on GitHub.
Diffstat (limited to 'src/nxt_sockaddr.c')
-rw-r--r--src/nxt_sockaddr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nxt_sockaddr.c b/src/nxt_sockaddr.c
index af696a6b..47ee165f 100644
--- a/src/nxt_sockaddr.c
+++ b/src/nxt_sockaddr.c
@@ -525,9 +525,9 @@ nxt_inet6_ntop(u_char *addr, u_char *buf, u_char *end)
return buf;
}
- zero_start = 8;
+ zero_start = 16;
zero_groups = 0;
- last_zero_start = 8;
+ last_zero_start = 16;
last_zero_groups = 0;
for (i = 0; i < 16; i += 2) {