fix subheader parsing

This commit is contained in:
Andre Puschmann 2018-03-19 14:38:27 +01:00
parent 8b04d7c308
commit c5b423ffee
2 changed files with 5 additions and 6 deletions

View File

@ -136,13 +136,12 @@ public:
nof_subheaders = 0;
bool ret = false;
do {
if (nof_subheaders < (int) max_subheaders) {
if (nof_subheaders < (int)max_subheaders) {
ret = subheaders[nof_subheaders].read_subheader(&ptr);
nof_subheaders++;
}
} while (ret && nof_subheaders < (int) max_subheaders);
if (nof_subheaders + 1 < (int) max_subheaders) {
nof_subheaders++;
}
} while (ret && (nof_subheaders + 1) < (int)max_subheaders);
for (int i=0;i<nof_subheaders;i++) {
subheaders[i].read_payload(&ptr);
}

View File

@ -122,7 +122,7 @@ uint8_t* sch_pdu::write_packet(srslte::log *log_h)
sch_subh padding;
padding.set_padding();
if (nof_subheaders <= 0 && nof_subheaders < max_subheaders) {
if (nof_subheaders <= 0 && nof_subheaders < (int)max_subheaders) {
log_h->error("Trying to write packet with invalid number of subheaders (nof_subheaders=%d).\n", nof_subheaders);
log_h->console("Trying to write packet with invalid number of subheaders (nof_subheaders=%d).\n", nof_subheaders);
return NULL;