comparison src/event/ngx_event_quic_transport.c @ 8387:eebdda507ec3 quic

Added tests for connection id lengths in initial packet.
author Vladimir Homutov <vl@nginx.com>
date Thu, 14 May 2020 14:49:28 +0300
parents 81f85c479d7e
children 2d5db7faa788
comparison
equal deleted inserted replaced
8386:81f85c479d7e 8387:eebdda507ec3
281 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, 281 ngx_log_error(NGX_LOG_INFO, pkt->log, 0,
282 "quic packet is too small to read dcid len"); 282 "quic packet is too small to read dcid len");
283 return NGX_ERROR; 283 return NGX_ERROR;
284 } 284 }
285 285
286 if (idlen > NGX_QUIC_CID_LEN_MAX) {
287 ngx_log_error(NGX_LOG_INFO, pkt->log, 0,
288 "quic packet dcid is too long");
289 return NGX_ERROR;
290 }
291
286 pkt->dcid.len = idlen; 292 pkt->dcid.len = idlen;
287 293
288 p = ngx_quic_read_bytes(p, end, idlen, &pkt->dcid.data); 294 p = ngx_quic_read_bytes(p, end, idlen, &pkt->dcid.data);
289 if (p == NULL) { 295 if (p == NULL) {
290 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, 296 ngx_log_error(NGX_LOG_INFO, pkt->log, 0,
294 300
295 p = ngx_quic_read_uint8(p, end, &idlen); 301 p = ngx_quic_read_uint8(p, end, &idlen);
296 if (p == NULL) { 302 if (p == NULL) {
297 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, 303 ngx_log_error(NGX_LOG_INFO, pkt->log, 0,
298 "quic packet is too small to read scid len"); 304 "quic packet is too small to read scid len");
305 return NGX_ERROR;
306 }
307
308 if (idlen > NGX_QUIC_CID_LEN_MAX) {
309 ngx_log_error(NGX_LOG_INFO, pkt->log, 0,
310 "quic packet scid is too long");
299 return NGX_ERROR; 311 return NGX_ERROR;
300 } 312 }
301 313
302 pkt->scid.len = idlen; 314 pkt->scid.len = idlen;
303 315