|
35 | 35 | /* Make scalar initialization form of nghttp2_hd_entry */ |
36 | 36 | #define MAKE_STATIC_ENT(N, V, T, H) \ |
37 | 37 | { \ |
38 | | - {NULL, NULL, (uint8_t *)(N), sizeof((N)) - 1, -1}, \ |
39 | | - {NULL, NULL, (uint8_t *)(V), sizeof((V)) - 1, -1}, \ |
40 | | - {(uint8_t *)(N), (uint8_t *)(V), sizeof((N)) - 1, sizeof((V)) - 1, 0}, \ |
| 38 | + {NULL, NULL, (uint8_t *)(N), nghttp2_strlen_lit((N)), -1}, \ |
| 39 | + {NULL, NULL, (uint8_t *)(V), nghttp2_strlen_lit((V)), -1}, \ |
| 40 | + {(uint8_t *)(N), (uint8_t *)(V), nghttp2_strlen_lit((N)), \ |
| 41 | + nghttp2_strlen_lit((V)), 0}, \ |
41 | 42 | T, \ |
42 | 43 | H, \ |
43 | 44 | } |
@@ -2058,8 +2059,9 @@ nghttp2_ssize nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater, |
2058 | 2059 |
|
2059 | 2060 | inflater->state = NGHTTP2_HD_STATE_NEWNAME_READ_NAMEHUFF; |
2060 | 2061 |
|
2061 | | - rv = |
2062 | | - nghttp2_rcbuf_new(&inflater->namercbuf, inflater->left * 2 + 1, mem); |
| 2062 | + rv = nghttp2_rcbuf_new( |
| 2063 | + &inflater->namercbuf, |
| 2064 | + nghttp2_huff_estimate_decode_length(inflater->left) + 1, mem); |
2063 | 2065 | } else { |
2064 | 2066 | inflater->state = NGHTTP2_HD_STATE_NEWNAME_READ_NAME; |
2065 | 2067 | rv = nghttp2_rcbuf_new(&inflater->namercbuf, inflater->left + 1, mem); |
@@ -2143,8 +2145,9 @@ nghttp2_ssize nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater, |
2143 | 2145 |
|
2144 | 2146 | inflater->state = NGHTTP2_HD_STATE_READ_VALUEHUFF; |
2145 | 2147 |
|
2146 | | - rv = |
2147 | | - nghttp2_rcbuf_new(&inflater->valuercbuf, inflater->left * 2 + 1, mem); |
| 2148 | + rv = nghttp2_rcbuf_new( |
| 2149 | + &inflater->valuercbuf, |
| 2150 | + nghttp2_huff_estimate_decode_length(inflater->left) + 1, mem); |
2148 | 2151 | } else { |
2149 | 2152 | inflater->state = NGHTTP2_HD_STATE_READ_VALUE; |
2150 | 2153 |
|
|
0 commit comments