diff options
author | Roman Arutyunyan <arut@nginx.com> | 2023-04-27 19:52:40 +0400 |
---|---|---|
committer | Roman Arutyunyan <arut@nginx.com> | 2023-04-27 19:52:40 +0400 |
commit | 906e3b5dca2352ba3799b41b181a3ca617dc3329 (patch) | |
tree | a0318e51cdc357393a0f4fd03185873f3f6ee9b1 /src | |
parent | 12fa86dd928a22ab6f07a1e73f3af7f703507337 (diff) | |
download | nginx-906e3b5dca2352ba3799b41b181a3ca617dc3329.tar.gz nginx-906e3b5dca2352ba3799b41b181a3ca617dc3329.zip |
QUIC: fixed addr_text after migration (ticket #2488).
Previously, the post-migration value of addr_text could be truncated, if
it was longer than the previous one. Also, the new value always included
port, which should not be there.
Diffstat (limited to 'src')
-rw-r--r-- | src/event/quic/ngx_event_quic_migration.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/event/quic/ngx_event_quic_migration.c b/src/event/quic/ngx_event_quic_migration.c index 035318764..cf0438fbc 100644 --- a/src/event/quic/ngx_event_quic_migration.c +++ b/src/event/quic/ngx_event_quic_migration.c @@ -387,16 +387,13 @@ ngx_quic_free_path(ngx_connection_t *c, ngx_quic_path_t *path) static void ngx_quic_set_connection_path(ngx_connection_t *c, ngx_quic_path_t *path) { - size_t len; - ngx_memcpy(c->sockaddr, path->sockaddr, path->socklen); c->socklen = path->socklen; if (c->addr_text.data) { - len = ngx_min(c->addr_text.len, path->addr_text.len); - - ngx_memcpy(c->addr_text.data, path->addr_text.data, len); - c->addr_text.len = len; + c->addr_text.len = ngx_sock_ntop(c->sockaddr, c->socklen, + c->addr_text.data, + c->listening->addr_text_max_len, 0); } ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, |