From a21c3b36b8310f4e4fda20a31df7537d54377c0b Mon Sep 17 00:00:00 2001 From: Amin Ben Romdhane Date: Fri, 30 Aug 2024 15:51:51 +0000 Subject: [PATCH] B#15082: bbfdm does not fault on invalid wildcard usages --- libbbfdm-api/dmbbf.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libbbfdm-api/dmbbf.c b/libbbfdm-api/dmbbf.c index 43a7691f..bdca572e 100644 --- a/libbbfdm-api/dmbbf.c +++ b/libbbfdm-api/dmbbf.c @@ -1495,6 +1495,8 @@ static void __get_ubus_name(struct ubus_request *req, int type, struct blob_attr if (tb[1]) { dmctx->faultcode = blobmsg_get_u32(tb[1]); return; + } else { + dmctx->faultcode = 0; } dmctx->findparam = 1; @@ -1532,10 +1534,16 @@ static int get_ubus_name(struct dmctx *dmctx, struct dmnode *node) blobmsg_add_u8(&blob, "first_level", dmctx->nextlevel); prepare_optional_table(dmctx, &blob); - ubus_call_blob_msg(ubus_name, "schema", &blob, 5000, __get_ubus_name, dmctx); + int res = ubus_call_blob_msg(ubus_name, "schema", &blob, 5000, __get_ubus_name, dmctx); blob_buf_free(&blob); + if (res) + return FAULT_9005; + + if (dmctx->faultcode) + return dmctx->faultcode; + return 0; }