From f8da73bd042f810f34d19f9eae02b46d870af394 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sun, 19 Apr 2020 09:12:24 -0700 Subject: [PATCH] Earlier check for settings flood --- lib/nghttp2_session.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index 415e3477..39f81f49 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -5653,6 +5653,12 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, break; } + /* Check the settings flood counter early to be safe */ + if (session->obq_flood_counter_ >= session->max_outbound_ack && + !(iframe->frame.hd.flags & NGHTTP2_FLAG_ACK)) { + return NGHTTP2_ERR_FLOODED; + } + iframe->state = NGHTTP2_IB_READ_SETTINGS; if (iframe->payloadleft) {