diff --git a/tests/nghttp2_frame_test.c b/tests/nghttp2_frame_test.c index 3c620e37..7a712fc6 100644 --- a/tests/nghttp2_frame_test.c +++ b/tests/nghttp2_frame_test.c @@ -138,7 +138,7 @@ void test_nghttp2_frame_pack_headers_frame_too_large(void) ssize_t nvlen; size_t big_vallen = NGHTTP2_MAX_HD_VALUE_LENGTH; char *big_hds[17]; - size_t big_hdslen = sizeof(big_hds)/sizeof(big_hds[0]); + size_t big_hdslen = sizeof(big_hds)/sizeof(big_hds[0]) - 1; size_t i; for(i = 0; i < big_hdslen; i += 2) { @@ -147,7 +147,7 @@ void test_nghttp2_frame_pack_headers_frame_too_large(void) memset(big_hds[i+1], '0'+i, big_vallen); big_hds[i+1][big_vallen] = '\0'; } - big_hds[big_hdslen - 1] = NULL; + big_hds[big_hdslen] = NULL; nvlen = nghttp2_nv_array_from_cstr(&nva, (const char**)big_hds); nghttp2_hd_deflate_init(&deflater, NGHTTP2_HD_SIDE_CLIENT); diff --git a/tests/nghttp2_session_test.c b/tests/nghttp2_session_test.c index 37b5be77..738fa0dd 100644 --- a/tests/nghttp2_session_test.c +++ b/tests/nghttp2_session_test.c @@ -1376,7 +1376,7 @@ void test_nghttp2_session_send_headers_header_comp_error(void) ssize_t nvlen; size_t vallen = NGHTTP2_MAX_HD_VALUE_LENGTH; char *nv[17]; - size_t nnv = sizeof(nv)/sizeof(nv[0]); + size_t nnv = sizeof(nv)/sizeof(nv[0]) - 1; size_t i; for(i = 0; i < nnv; i += 2) { @@ -1385,7 +1385,7 @@ void test_nghttp2_session_send_headers_header_comp_error(void) memset(nv[i+1], '0'+i, vallen); nv[i+1][vallen] = '\0'; } - nv[nnv - 1] = NULL; + nv[nnv] = NULL; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); callbacks.send_callback = null_send_callback;