NAN Dissector has wrong minimum length for availability attribute
Summary
Valid availability attributes are not decoded and marked invalid
Steps to reproduce
What is the current bug behavior?
Attribute is marked as having invalid length.
What is the expected correct behavior?
Attribute should be decoded without any issues.
Sample capture file
Relevant logs and/or screenshots
This is sample of valid availability attribute which is not decoded correctly by dissector:
12 09 00 00 11 00 04 00 ea 01 10 02
maps to:
12 Attribute ID
09 00 Length
00 Sequence ID
11 00 Attribute Control (table 86)
Availability Entry (table 87)
04 00 Length
ea 01 Entry control
10 Band entry with count of 1
02 Band entry (2.4G)
Proposed fix
In "packet-wifi-nan.c" Min length is set to 10, this should be reduced to 8.
#define NAN_AVAILABILITY_MIN_LENGTH 10
static void
dissect_attr_availability(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr_len, packet_info* pinfo)
{
if (attr_len < NAN_AVAILABILITY_MIN_LENGTH)
{
expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
return;
}
Build information
3.4.3 (v3.4.3-0-g6ae6cd335aa9)
Compiled (64-bit) with Qt 5.15.1, with libpcap, with GLib 2.52.3, with zlib
1.2.11, with SMI 0.4.8, with c-ares 1.15.0, with Lua 5.2.4, with GnuTLS 3.6.3
and PKCS #11 support, with Gcrypt 1.8.3, with MIT Kerberos, with MaxMind DB
resolver, with nghttp2 1.39.2, with brotli, with LZ4, with Zstandard, with
Snappy, with libxml2 2.9.9, with QtMultimedia, with automatic updates using
WinSparkle 0.5.7, with AirPcap, with SpeexDSP (using bundled resampler), with
Minizip.
Running on 64-bit Windows 10 (1809), build 17763, with Intel(R) Core(TM)
i5-6440HQ CPU @ 2.60GHz (with SSE4.2), with 16265 MB of physical memory, with
locale English_United Kingdom.utf8, with light display mode, with HiDPI, with
Npcap version 1.10, based on libpcap version 1.9.1, with GnuTLS 3.6.3, with
Gcrypt 1.8.3, with brotli 1.0.2, without AirPcap, binary plugins supported (21
loaded).
Built using Microsoft Visual Studio 2019 (VC++ 14.28, build 29336).
Edited by Behzad Mokhtari