MINOR: quic: fix segfault on CONNECTION_CLOSE parsing

At the moment the reason_phrase member of a
quic_connection_close/quic_connection_close_app structure is not
allocated. Comment the memcpy to it to avoid segfault.
This commit is contained in:
Amaury Denoyelle 2021-12-07 15:32:00 +01:00
parent b154422db1
commit 942fc79b5f

View File

@ -821,7 +821,8 @@ static int quic_build_connection_close_app_frame(unsigned char **buf, const unsi
return 0;
if (connection_close_app->reason_phrase_len) {
memcpy(*buf, connection_close_app->reason_phrase, connection_close_app->reason_phrase_len);
// TODO reason_phrase is not allocated
//memcpy(*buf, connection_close_app->reason_phrase, connection_close_app->reason_phrase_len);
*buf += connection_close_app->reason_phrase_len;
}
@ -843,7 +844,8 @@ static int quic_parse_connection_close_app_frame(struct quic_frame *frm, struct
end - *buf < connection_close_app->reason_phrase_len)
return 0;
memcpy(connection_close_app->reason_phrase, *buf, connection_close_app->reason_phrase_len);
// TODO reason_phrase is not allocated
//memcpy(connection_close_app->reason_phrase, *buf, connection_close_app->reason_phrase_len);
*buf += connection_close_app->reason_phrase_len;
return 1;