diff options
author | Kevin Grigorenko <kevin.grigorenko@us.ibm.com> | 2023-01-19 17:35:48 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2023-01-19 17:35:48 +0000 |
commit | 43c5eedc97c3e7e19ead0c2353bc4ad79d656dba (patch) | |
tree | 9dd0f25e3c1123f0c4a7e5dfe3f1387bf2aed1ad /epan/dissectors/packet-http2.c | |
parent | 74909f14992263e623092e4b08d4bad9cc08f5f1 (diff) |
Handle NULL http2_session_t parsing an H2 settings frame
Diffstat (limited to 'epan/dissectors/packet-http2.c')
-rw-r--r-- | epan/dissectors/packet-http2.c | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/epan/dissectors/packet-http2.c b/epan/dissectors/packet-http2.c index dc03fbd6a8..5e7bcf5485 100644 --- a/epan/dissectors/packet-http2.c +++ b/epan/dissectors/packet-http2.c @@ -3618,42 +3618,43 @@ dissect_http2_settings(tvbuff_t* tvb, packet_info* pinfo _U_, http2_session_t* h case HTTP2_SETTINGS_INITIAL_WINDOW_SIZE: { guint32 newInitialWindowSize; - guint32 flow_index; proto_tree_add_item_ret_uint(settings_tree, hf_http2_settings_initial_window_size, tvb, offset, 4, ENC_BIG_ENDIAN, &newInitialWindowSize); - flow_index = select_http2_flow_index(pinfo, h2session); + if (h2session) { + guint32 flow_index = select_http2_flow_index(pinfo, h2session); - /* This new initial window size will be applied to - * any new future streams going in the other direction. - * Note that this setting does not apply to the connection: - * https://lists.w3.org/Archives/Public/ietf-http-wg/2023JanMar/0003.html - */ - flow_index ^= 1; + /* This new initial window size will be applied to + * any new future streams going in the other direction. + * Note that this setting does not apply to the connection: + * https://lists.w3.org/Archives/Public/ietf-http-wg/2023JanMar/0003.html + */ + flow_index ^= 1; - h2session->initial_new_stream_window_size[flow_index] = newInitialWindowSize; + h2session->initial_new_stream_window_size[flow_index] = newInitialWindowSize; #ifdef HAVE_NGHTTP2 - { - guint32 previousInitialWindowSize = h2session->initial_new_stream_window_size[flow_index]; - gint32 windowSizeDiff = newInitialWindowSize - previousInitialWindowSize; - - /* "When the value of SETTINGS_INITIAL_WINDOW_SIZE changes, - * a receiver MUST adjust the size of all stream flow-control - * windows that it maintains by the difference between the - * new value and the old value." - * https://www.ietf.org/rfc/rfc9113.html#section-6.9.2-3 - */ - if (windowSizeDiff != 0) { - http2_adjust_window_t userData; - - userData.windowSizeDiff = windowSizeDiff; - userData.flow_index = flow_index; - - wmem_map_foreach(h2session->per_stream_info, adjust_existing_window, &userData); + { + guint32 previousInitialWindowSize = h2session->initial_new_stream_window_size[flow_index]; + gint32 windowSizeDiff = newInitialWindowSize - previousInitialWindowSize; + + /* "When the value of SETTINGS_INITIAL_WINDOW_SIZE changes, + * a receiver MUST adjust the size of all stream flow-control + * windows that it maintains by the difference between the + * new value and the old value." + * https://www.ietf.org/rfc/rfc9113.html#section-6.9.2-3 + */ + if (windowSizeDiff != 0) { + http2_adjust_window_t userData; + + userData.windowSizeDiff = windowSizeDiff; + userData.flow_index = flow_index; + + wmem_map_foreach(h2session->per_stream_info, adjust_existing_window, &userData); + } } - } #endif + } } break; case HTTP2_SETTINGS_MAX_FRAME_SIZE: |