Incorrect decoding of FreshnessPeriod
Closed this issue · 1 comments
yoursunny commented
As of 5b43c5f, ndn_metainfo_tlv_decode
invokes:
else if (probe == TLV_FreshnessPeriod) {
decoder_get_length(decoder, &probe);
decoder_get_uint32_value(decoder, &meta->freshness_period);
meta->enable_FreshnessPeriod = 1;
}
It assumes FreshnessPeriod has TLV-LENGTH=4 without checking it.
NDN Packet Format v0.3 specifies that FreshnessPeriod element is NonNegativeInteger that could have 1, 2, 4, or 8 octets.
Consequently, the decoding function would read FreshnessPeriod incorrectly if its TLV-LENGTH is not 4.
tianyuan129 commented