From cf0b880b15943399ee23fcd68c4e3e8cb68f01c4 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Tue, 11 Feb 2014 16:53:08 +0900 Subject: [PATCH] Error if undefined SETTINGS ID is detected in nghttp2_iv_check --- lib/nghttp2_frame.c | 2 ++ tests/nghttp2_frame_test.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/lib/nghttp2_frame.c b/lib/nghttp2_frame.c index 077ae1e6..c6318c1e 100644 --- a/lib/nghttp2_frame.c +++ b/lib/nghttp2_frame.c @@ -640,6 +640,8 @@ int nghttp2_iv_check(const nghttp2_settings_entry *iv, size_t niv) return 0; } break; + default: + return 0; } } return 1; diff --git a/tests/nghttp2_frame_test.c b/tests/nghttp2_frame_test.c index 56abc95d..d6495d19 100644 --- a/tests/nghttp2_frame_test.c +++ b/tests/nghttp2_frame_test.c @@ -434,4 +434,9 @@ void test_nghttp2_iv_check(void) CU_ASSERT(nghttp2_iv_check(iv, 2)); iv[1].value = 3; CU_ASSERT(!nghttp2_iv_check(iv, 2)); + + /* Undefined SETTINGS ID */ + iv[1].settings_id = 1000000009; + iv[1].value = 0; + CU_ASSERT(!nghttp2_iv_check(iv, 2)); }