From c5b423ffee5e852a5e4c82c6369fbf409d59243b Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Mon, 19 Mar 2018 14:38:27 +0100 Subject: [PATCH] fix subheader parsing --- lib/include/srslte/common/pdu.h | 9 ++++----- lib/src/common/pdu.cc | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/include/srslte/common/pdu.h b/lib/include/srslte/common/pdu.h index 20fe91816..5d0f5a235 100644 --- a/lib/include/srslte/common/pdu.h +++ b/lib/include/srslte/common/pdu.h @@ -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;ierror("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;