aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJordan Augé <jordan.auge+fdio@cisco.com>2019-10-08 11:36:06 +0000
committerGerrit Code Review <gerrit@fd.io>2019-10-08 11:36:06 +0000
commit13b8a7b4543c53cd4ea04f67be42c487ea431a40 (patch)
tree611cbed20b8125f087795e646f61169a3263869e
parent1bc4aca90da898424da7609af59aec5ac4770f73 (diff)
parentd672e0fa1d4502603a064e390fba21691735a6d3 (diff)
Merge "[HICN-303] Fixed reading size of authentication header which might have caused a bufferoverflow"
-rw-r--r--lib/src/compat.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/src/compat.c b/lib/src/compat.c
index 9834b9d44..d76e17a6d 100644
--- a/lib/src/compat.c
+++ b/lib/src/compat.c
@@ -182,8 +182,10 @@ hicn_packet_get_header_length (hicn_format_t format, const hicn_header_t * h,
int is_ipv4 = _is_ipv4 (format);
int is_ipv6 = _is_ipv6 (format);
// The signature payload is expressed as number of 32 bits words
- *header_length += (is_ah * is_ipv4) * (h->v4ah.ah.payloadlen) << 2;
- *header_length += (is_ah * is_ipv6) * (h->v6ah.ah.payloadlen) << 2;
+ if (is_ah && is_ipv4)
+ *header_length += (h->v4ah.ah.payloadlen) << 2;
+ else if(is_ah && is_ipv6)
+ *header_length += (h->v6ah.ah.payloadlen) << 2;
return HICN_LIB_ERROR_NONE;
}