comparison src/event/ngx_event_quic_transport.c @ 8342:76e8ec502c69 quic

Fixed error descriptions. The check for array bound is done inside function that returns error description. Missing initialization element is added.
author Vladimir Homutov <vl@nginx.com>
date Thu, 16 Apr 2020 16:54:22 +0300
parents 0f9e9786b90d
children e0abe17a2878
comparison
equal deleted inserted replaced
8341:efc0a65424e8 8342:76e8ec502c69
97 "FRAME_ENCODING_ERROR", 97 "FRAME_ENCODING_ERROR",
98 "TRANSPORT_PARAMETER_ERROR", 98 "TRANSPORT_PARAMETER_ERROR",
99 "CONNECTION_ID_LIMIT_ERROR", 99 "CONNECTION_ID_LIMIT_ERROR",
100 "PROTOCOL_VIOLATION", 100 "PROTOCOL_VIOLATION",
101 "INVALID_TOKEN", 101 "INVALID_TOKEN",
102 "", 102 "unknown error 0xC",
103 "CRYPTO_BUFFER_EXCEEDED", 103 "CRYPTO_BUFFER_EXCEEDED",
104 "", 104 "unknown error 0xE",
105 "unknown error 0xF",
105 "CRYPTO_ERROR", 106 "CRYPTO_ERROR",
106 }; 107 };
107 108
108 109
109 static ngx_inline u_char * 110 static ngx_inline u_char *
264 265
265 266
266 u_char * 267 u_char *
267 ngx_quic_error_text(uint64_t error_code) 268 ngx_quic_error_text(uint64_t error_code)
268 { 269 {
270
271 if (error_code >= NGX_QUIC_ERR_LAST) {
272 return (u_char *) "unknown error";
273 }
274
269 return (u_char *) ngx_quic_errors[error_code]; 275 return (u_char *) ngx_quic_errors[error_code];
270 } 276 }
271 277
272 278
273 ngx_int_t 279 ngx_int_t
774 "failed to parse close reason"); 780 "failed to parse close reason");
775 return NGX_ERROR; 781 return NGX_ERROR;
776 } 782 }
777 783
778 if (f->type == NGX_QUIC_FT_CONNECTION_CLOSE) { 784 if (f->type == NGX_QUIC_FT_CONNECTION_CLOSE) {
779
780 if (f->u.close.error_code >= NGX_QUIC_ERR_LAST) {
781 ngx_log_error(NGX_LOG_INFO, pkt->log, 0,
782 "unkown error code: %ui, truncated",
783 f->u.close.error_code);
784 f->u.close.error_code = NGX_QUIC_ERR_LAST - 1;
785 }
786 785
787 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, pkt->log, 0, 786 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
788 "CONN.CLOSE: { %s (0x%xi) type=0x%xi reason='%V'}", 787 "CONN.CLOSE: { %s (0x%xi) type=0x%xi reason='%V'}",
789 ngx_quic_error_text(f->u.close.error_code), 788 ngx_quic_error_text(f->u.close.error_code),
790 f->u.close.error_code, f->u.close.frame_type, 789 f->u.close.error_code, f->u.close.frame_type,