From 5d2ee7e72c62db67ee3f70805e7d40f3c154209f Mon Sep 17 00:00:00 2001 From: Neels Janosch Hofmeyr Date: Sat, 16 Mar 2024 05:51:23 +0100 Subject: pfcp up_function_features: allow shorter lengths eUPF sends a short CP Function Features bitmap, which is easy to solve by just zero padding to the minimum length specified in PFCP (3GPP TS 29.244) Related: SYS#6590 Change-Id: I40e255fd0b4770e578aea7a10ba88f5eeba087f4 --- src/libosmo-pfcp/pfcp_ies_custom.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libosmo-pfcp/pfcp_ies_custom.c b/src/libosmo-pfcp/pfcp_ies_custom.c index e2e9f02..d3ecda5 100644 --- a/src/libosmo-pfcp/pfcp_ies_custom.c +++ b/src/libosmo-pfcp/pfcp_ies_custom.c @@ -431,8 +431,10 @@ char *osmo_pfcp_bits_to_str_c(void *ctx, const uint8_t *bits, const struct value int osmo_pfcp_dec_up_function_features(void *decoded_struct, void *decode_to, const struct osmo_gtlv_load *tlv) { struct osmo_pfcp_ie_up_function_features *up_function_features = decode_to; - ENSURE_LENGTH_IS_AT_LEAST(6); - memcpy(up_function_features->bits, tlv->val, 6); + /* 3GPP TS 29.244 version 16.6.0 Release 16 8.2.25 UP Function Features defines at least 6 octets of bits, but + * if the peer sends less octets, make do with what we get. */ + memset(up_function_features->bits, 0, sizeof(up_function_features->bits)); + memcpy(up_function_features->bits, tlv->val, OSMO_MIN(sizeof(up_function_features->bits), tlv->len)); return 0; } -- cgit v1.2.3