From 3c26d09a7f1e3f936effc06c9d9db895d730406e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 5 Jun 2015 14:48:30 -0700 Subject: Add a test of bad settings frame (and fix a bug!) --- src/core/transport/chttp2_transport.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/core/transport/chttp2_transport.c') diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index 9dc5f23389..630504565b 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -1575,12 +1575,21 @@ static int init_goaway_parser(transport *t) { } static int init_settings_frame_parser(transport *t) { - int ok = GRPC_CHTTP2_PARSE_OK == + int ok; + + if (t->incoming_stream_id != 0) { + gpr_log(GPR_ERROR, "settings frame received for stream %d", t->incoming_stream_id); + drop_connection(t); + return 0; + } + + ok = GRPC_CHTTP2_PARSE_OK == grpc_chttp2_settings_parser_begin_frame( &t->simple_parsers.settings, t->incoming_frame_size, t->incoming_frame_flags, t->settings[PEER_SETTINGS]); if (!ok) { drop_connection(t); + return 0; } if (t->incoming_frame_flags & GRPC_CHTTP2_FLAG_ACK) { memcpy(t->settings[ACKED_SETTINGS], t->settings[SENT_SETTINGS], -- cgit v1.2.3