Correct buffer size for do_NR_DLInformationTransfer()

uper_encode_to_buffer() of asn1c returns the number of BITS that have
been encoded; if we use this, we need to calculate the resulting number
of bytes (rounding up) to get the right buffer size.

Note that do_NR_ULInformationTransfer() uses
uper_encode_to_new_buffer() which returns the number of BYTES, hence, in
this similar function, we should not modify the return value.
This commit is contained in:
Robert Schmidt
2024-05-16 11:59:55 +02:00
parent 82bd07ebd5
commit 9fd1b9ac69
+1 -1
View File
@@ -941,7 +941,7 @@ uint8_t do_NR_DLInformationTransfer(uint8_t *buffer,
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NR_DL_DCCH_Message, &dl_dcch_msg);
LOG_D(NR_RRC, "DLInformationTransfer Encoded %zd bytes\n", r.encoded);
// for (int i=0;i<encoded;i++) printf("%02x ",(*buffer)[i]);
return r.encoded;
return (r.encoded + 7) / 8;
}
uint8_t do_NR_ULInformationTransfer(uint8_t **buffer, uint32_t pdu_length, uint8_t *pdu_buffer) {