asn1: fix amf-ngap-ue-id unpacking overflow bug

This commit is contained in:
Francisco 2022-04-11 21:56:56 +01:00 committed by Andre Puschmann
parent ba092c0e9b
commit 6984159c6f
1 changed files with 1 additions and 1 deletions

View File

@ -186,7 +186,7 @@ SRSASN_CODE unpack_bits(T& val, Ptr& ptr, uint8_t& offset, const uint8_t* max_pt
n_bits = 0;
} else {
auto mask = static_cast<uint8_t>((1u << (8u - offset)) - 1u);
val += ((uint32_t)((*ptr) & mask)) << (n_bits - 8 + offset);
val += static_cast<T>((*ptr) & mask) << (n_bits - 8 + offset);
n_bits -= 8 - offset;
offset = 0;
ptr++;