From 40a5756564b3a3316c0f099ec84d38bd82e8eb08 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 6 Feb 2014 21:42:49 +0900 Subject: [PATCH] Terminate connection if unknown frame type is received --- lib/nghttp2_session.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index 0108d542..4432d0fd 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -3432,7 +3432,9 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, iframe->state = NGHTTP2_IB_READ_NBYTE; iframe->left = 8; break; - case NGHTTP2_CONTINUATION: + default: + /* Receiving unknown frame type and CONTINUATION in this state + are subject to connection error of type PROTOCOL_ERROR */ rv = nghttp2_session_terminate_session(session, NGHTTP2_PROTOCOL_ERROR); if(nghttp2_is_fatal(rv)) { @@ -3441,10 +3443,6 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, busy = 1; iframe->state = NGHTTP2_IB_IGN_PAYLOAD; break; - default: - busy = 1; - iframe->state = NGHTTP2_IB_IGN_PAYLOAD; - break; } break; case NGHTTP2_IB_READ_NBYTE: