laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-cbc/+/28586 )
Change subject: rest_api: Fix cbs.data_user_len not set in 'payload_encoded' ......................................................................
rest_api: Fix cbs.data_user_len not set in 'payload_encoded'
This is later used in cbcmsg_to_cbsp(), but only set for type 'payload_decoded' in parse_payload_decoded().
Change-Id: I519cf300cd01e8c2728babeaa77b8486f47115be --- M src/rest_api.c 1 file changed, 5 insertions(+), 2 deletions(-)
Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved
diff --git a/src/rest_api.c b/src/rest_api.c index a779f3d..e596b77 100644 --- a/src/rest_api.c +++ b/src/rest_api.c @@ -317,7 +317,7 @@
if ((jtmp = json_object_get(in, "payload_encoded"))) { json_t *jpage_arr, *jpage; - int i, dcs, num_pages; + int i, dcs, num_pages, len;
out->is_etws = false; /* Data Coding Scheme */ @@ -340,6 +340,7 @@ return -EINVAL; } out->cbs.num_pages = num_pages; + out->cbs.data_user_len = 0; json_array_foreach(jpage_arr, i, jpage) { const char *hexstr; if (!json_is_string(jpage)) { @@ -351,10 +352,12 @@ *errstr = "'pages' array must contain strings up to 88 hex nibbles"; return -EINVAL; } - if (osmo_hexparse(hexstr, out->cbs.data[i], sizeof(out->cbs.data[i])) < 0) { + len = osmo_hexparse(hexstr, out->cbs.data[i], sizeof(out->cbs.data[i])); + if (len < 0) { *errstr = "'pages' array must contain hex strings"; return -EINVAL; } + out->cbs.data_user_len += len; } return 0; } else if ((jtmp = json_object_get(in, "payload_decoded"))) {