diff options
author | Peter Wu <peter@lekensteyn.nl> | 2020-05-31 15:33:33 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2020-06-01 03:40:33 +0000 |
commit | 43cfa9c1fae423d0a528116532f082a42cc44a5d (patch) | |
tree | ed983bdd189688661d2a4faf86ecc6ff79b94299 /epan/dissectors/packet-http2.c | |
parent | 507285a53433b3f90a1629a877e9a80d98bf59c7 (diff) |
http2: fix build error with nghttp2 before 1.11
nghttp2_hd_inflate_hd has only been deprecated because its "in" argument
is non-const, aside from this aspect the implementation is equivalent.
For inflate_http2_header_block there is no difference since the buffer
is already non-const. However in fix_partial_header_dissection_support,
the given buffer is const. To avoid new -Wcast-qual warnings while
keeping the buffer read-only, just add a simple wrapper function.
This fixes a build failure reported for libnghttp2-devel
1.7.1-1.15.x86_64 on openSUSE Leap 42.3.
Change-Id: I9ab9305ffc5920f5e3f4866c2f0378d45008b57a
Reviewed-on: https://code.wireshark.org/review/37346
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-http2.c')
-rw-r--r-- | epan/dissectors/packet-http2.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/epan/dissectors/packet-http2.c b/epan/dissectors/packet-http2.c index bec465a543..f729fd2309 100644 --- a/epan/dissectors/packet-http2.c +++ b/epan/dissectors/packet-http2.c @@ -1680,6 +1680,21 @@ try_add_named_header_field(proto_tree *tree, tvbuff_t *tvb, int offset, guint32 } } +#if NGHTTP2_VERSION_NUM < 0x010B00 /* 1.11.0 */ +static inline ssize_t nghttp2_hd_inflate_hd2(nghttp2_hd_inflater *inflater, + nghttp2_nv *nv_out, + int *inflate_flags, + const uint8_t *in, size_t inlen, + int in_final) +{ +DIAG_OFF(cast-qual) + uint8_t *in_buf = (uint8_t *)in; +DIAG_ON(cast-qual) + return nghttp2_hd_inflate_hd(inflater, nv_out, inflate_flags, in_buf, inlen, + in_final); +} +#endif + static void fix_partial_header_dissection_support(nghttp2_hd_inflater *hd_inflater, gboolean *fix_it) { @@ -1804,13 +1819,9 @@ inflate_http2_header_block(tvbuff_t *tvb, packet_info *pinfo, guint offset, prot break; } -#if (NGHTTP2_VERSION_NUM >= 0x010B00) rv = (int)nghttp2_hd_inflate_hd2(hd_inflater, &nv, - &inflate_flags, headbuf, headlen, final); -#else - rv = (int)nghttp2_hd_inflate_hd(hd_inflater, &nv, - &inflate_flags, headbuf, headlen, final); -#endif + &inflate_flags, headbuf, headlen, final); + if(rv < 0) { break; } |