return NGX_ERROR;
}
+ if (pkt->dcid.len < NGX_QUIC_CID_LEN_MIN) {
+ /* 7.2. Negotiating Connection IDs */
+ ngx_log_error(NGX_LOG_INFO, c->log, 0,
+ "quic too short dcid in initial packet: length %i",
+ pkt->dcid.len);
+ return NGX_ERROR;
+ }
+
c->log->action = "creating new quic connection";
qc = ngx_pcalloc(c->pool, sizeof(ngx_quic_connection_t));
return NGX_ERROR;
}
+ if (idlen > NGX_QUIC_CID_LEN_MAX) {
+ ngx_log_error(NGX_LOG_INFO, pkt->log, 0,
+ "quic packet dcid is too long");
+ return NGX_ERROR;
+ }
+
pkt->dcid.len = idlen;
p = ngx_quic_read_bytes(p, end, idlen, &pkt->dcid.data);
return NGX_ERROR;
}
+ if (idlen > NGX_QUIC_CID_LEN_MAX) {
+ ngx_log_error(NGX_LOG_INFO, pkt->log, 0,
+ "quic packet scid is too long");
+ return NGX_ERROR;
+ }
+
pkt->scid.len = idlen;
p = ngx_quic_read_bytes(p, end, idlen, &pkt->scid.data);
#define NGX_QUIC_TP_PREFERRED_ADDRESS 0x0D
#define NGX_QUIC_TP_ACTIVE_CONNECTION_ID_LIMIT 0x0E
+#define NGX_QUIC_CID_LEN_MIN 8
+#define NGX_QUIC_CID_LEN_MAX 20
+
typedef struct {
uint64_t largest;
uint64_t seqnum;
uint64_t retire;
uint8_t len;
- u_char cid[20];
+ u_char cid[NGX_QUIC_CID_LEN_MAX];
u_char srt[16];
} ngx_quic_new_conn_id_frame_t;