diff --git a/lib/nghttp2_frame.c b/lib/nghttp2_frame.c index 7ef34193..e6e6d655 100644 --- a/lib/nghttp2_frame.c +++ b/lib/nghttp2_frame.c @@ -513,8 +513,8 @@ size_t nghttp2_frame_pack_settings_payload(uint8_t *buf, { size_t i; for(i = 0; i < niv; ++i, buf += NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH) { - buf[0] = iv[i].settings_id; - nghttp2_put_uint32be(buf + 1, iv[i].value); + nghttp2_put_uint16be(buf, iv[i].settings_id); + nghttp2_put_uint32be(buf + 2, iv[i].value); } return NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH * niv; } @@ -544,8 +544,8 @@ int nghttp2_frame_unpack_settings_payload(nghttp2_settings *frame, void nghttp2_frame_unpack_settings_entry(nghttp2_settings_entry *iv, const uint8_t *payload) { - iv->settings_id = payload[0]; - iv->value = nghttp2_get_uint32(&payload[1]); + iv->settings_id = nghttp2_get_uint16(&payload[0]); + iv->value = nghttp2_get_uint32(&payload[2]); } int nghttp2_frame_unpack_settings_payload2(nghttp2_settings_entry **iv_ptr, diff --git a/lib/nghttp2_frame.h b/lib/nghttp2_frame.h index cf8e667a..cd9e9d27 100644 --- a/lib/nghttp2_frame.h +++ b/lib/nghttp2_frame.h @@ -55,7 +55,7 @@ #define NGHTTP2_DATA_PAYLOADLEN 4096 /* The number of bytes for each SETTINGS entry */ -#define NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH 5 +#define NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH 6 /* The maximum header table size in SETTINGS_HEADER_TABLE_SIZE */ #define NGHTTP2_MAX_HEADER_TABLE_SIZE ((1u << 31) - 1)