Add some sanity checks to the TLV fetch.

Obtained from:	Linux iwlwifi
This commit is contained in:
Adrian Chadd 2013-12-02 03:42:39 +00:00
parent c6f810c6a4
commit 9d8e8cd665
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=258824

View File

@ -7507,7 +7507,15 @@ iwn_read_firmware_tlv(struct iwn_softc *sc, struct iwn_fw_info *fw,
"PAN Support found: %d\n", 1);
break;
case IWN_FW_TLV_FLAGS:
sc->tlv_feature_flags = htole32(*ptr);
if (len < sizeof(uint32_t))
break;
if (len % sizeof(uint32_t))
break;
sc->tlv_feature_flags = le32toh(*ptr);
DPRINTF(sc, IWN_DEBUG_RESET,
"%s: feature: 0x%08x\n",
__func__,
sc->tlv_feature_flags);
break;
case IWN_FW_TLV_PBREQ_MAXLEN:
case IWN_FW_TLV_RUNT_EVTLOG_PTR: