From 30ebfe8bced94adf127a35a3b00945fba2ff6420 Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Sun, 10 Nov 2024 10:30:38 -0500 Subject: [PATCH] handle raw / unknown attributes with a "todo" to discover the actual type --- src/lib/util/cbor.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib/util/cbor.c b/src/lib/util/cbor.c index 91ea0897d17f0..9d126e4b9b4ba 100644 --- a/src/lib/util/cbor.c +++ b/src/lib/util/cbor.c @@ -1175,11 +1175,19 @@ ssize_t fr_cbor_decode_pair(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dbuff_t *db da = fr_dict_attr_child_by_num(parent, value); if (!da) { - fr_assert(0); /* @todo - yup! */ + /* + * @todo - the value here isn't a cbor octets type, but is instead cbor data. Since cbor + * is typed, we _could_ perhaps instead discover the type from the cbor data, and then + * use that instead. This would involve creating a function which maps cbor types to our + * data types. + */ + da = fr_dict_attr_unknown_raw_afrom_num(ctx, parent, value); + if (!da) goto oom; } vp = fr_pair_afrom_da(ctx, da); if (!vp) { + oom: fr_strerror_const("Out of memory"); return -fr_dbuff_used(&work_dbuff); }