Fix potential copy from NULL reference
@@ -53,11 +53,16 @@ picoquic_stored_ticket_t* picoquic_format_ticket(uint64_t time_valid_until,
*next_p++ = 0;
stored->ip_addr = (uint8_t *)next_p;
+ if (ip_addr == NULL || ip_addr_length == 0) {
+ stored->ip_addr_length = 0;
+ }
+ else {
if (ip_addr_length > PICOQUIC_STORED_IP_MAX) {
ip_addr_length = PICOQUIC_STORED_IP_MAX;
}
stored->ip_addr_length = ip_addr_length;
memcpy(next_p, ip_addr, ip_addr_length);
+ }
next_p += PICOQUIC_STORED_IP_MAX;
if (tp != NULL) {
