From 00a6f92b97a0456259163ade2085defdebeb3f84 Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Fri, 2 Sep 2022 11:17:49 +0000 Subject: fix: correct bugs in interest processing pipeline ResHHICN-748 Change-Id: I8e55932fda2c77891f7b2aaf7fa5d7087f1aa2bf Signed-off-by: Mauro Sardara --- hicn-light/src/hicn/core/forwarder.c | 2 +- libtransport/src/core/portal.h | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hicn-light/src/hicn/core/forwarder.c b/hicn-light/src/hicn/core/forwarder.c index 4fe1b6c63..72bb22118 100644 --- a/hicn-light/src/hicn/core/forwarder.c +++ b/hicn-light/src/hicn/core/forwarder.c @@ -1053,7 +1053,7 @@ static ssize_t forwarder_process_interest(forwarder_t *forwarder, assert(msgbuf_get_type(msgbuf) == HICN_PACKET_TYPE_INTEREST); u32 n_suffixes = 0; - interest_manifest_header_t *int_manifest_header; + interest_manifest_header_t *int_manifest_header = NULL; size_t payload_size; int ret = _forwarder_get_interest_manifest(msgbuf, &int_manifest_header, &payload_size); diff --git a/libtransport/src/core/portal.h b/libtransport/src/core/portal.h index d4fbb3442..7a6ab9d0e 100644 --- a/libtransport/src/core/portal.h +++ b/libtransport/src/core/portal.h @@ -319,8 +319,11 @@ class Portal : public ::utils::NonCopyable, uint32_t initial_hash = interest->getName().getHash32(false); auto hash = initial_hash + interest->getName().getSuffix(); uint32_t seq = interest->getName().getSuffix(); - const uint32_t *suffix = interest->firstSuffix() + 1; - auto n_suffixes = interest->numberOfSuffixes() - 1; + const uint32_t *suffix = interest->firstSuffix() != nullptr + ? interest->firstSuffix() + 1 + : nullptr; + auto n_suffixes = + interest->numberOfSuffixes() > 0 ? interest->numberOfSuffixes() - 1 : 0; uint32_t counter = 0; // Set timers do { -- cgit 1.2.3-korg