ieee80211: Remove zero-length array usage

Remove the zero-length array usage to fix warnings reported about
using this extended feature.

Fixes: v2.9.0rc0-2520-g61ccf52107 ("ieee80211: Decrypt and dissect EAPOL
keydata")

Change-Id: I62eceb543e3398db2eee22e12609959e27d684f7
Reviewed-on: https://code.wireshark.org/review/32781
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
This commit is contained in:
Mikael Kanstrup 2019-04-08 11:10:18 +02:00 committed by Alexis La Goutte
parent a9861fb4cf
commit 7a793e5cd4
1 changed files with 4 additions and 7 deletions

View File

@ -85,12 +85,9 @@ void proto_register_wlan_rsna_eapol(void);
typedef struct {
DOT11DECRYPT_KEY_ITEM used_key;
guint keydata_len;
guint8 keydata[0]; /* dynamic size */
guint8 *keydata;
} proto_eapol_keydata_t;
#define PROTO_EAPOL_KEYDATA_OFFSET (offsetof(proto_eapol_keydata_t, keydata))
#define PROTO_EAPOL_MAX_SIZE (DOT11DECRYPT_MAX_CAPLEN + PROTO_EAPOL_KEYDATA_OFFSET)
extern value_string_ext eap_type_vals_ext; /* from packet-eap.c */
#ifndef roundup2
@ -25692,10 +25689,10 @@ try_decrypt(tvbuff_t *tvb, packet_info *pinfo, guint offset, guint len, gboolean
} else if (ret == DOT11DECRYPT_RET_SUCCESS_HANDSHAKE && dec_caplen > 0) {
proto_eapol_keydata_t *eapol;
eapol = (proto_eapol_keydata_t *)wmem_alloc(wmem_file_scope(),
dec_caplen + PROTO_EAPOL_KEYDATA_OFFSET);
memcpy(&eapol->used_key, used_key, sizeof(*used_key));
memcpy(eapol->keydata, dec_data, dec_caplen);
sizeof(proto_eapol_keydata_t));
eapol->used_key = *used_key;
eapol->keydata_len = dec_caplen;
eapol->keydata = (guint8 *)wmem_memdup(wmem_file_scope(), dec_data, dec_caplen);
/* Save decrypted eapol keydata for rsna dissector */
p_add_proto_data(wmem_file_scope(), pinfo, proto_wlan, EAPOL_KEY, eapol);