This is an automated email from the ASF dual-hosted git repository. sjanc pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-mcumgr.git
commit 8c63d871089b899369e64be51033851ddb27f40e Author: Szymon Janc <[email protected]> AuthorDate: Wed Oct 7 16:10:48 2026 +0200 omp: Fix header read with missing header field Header length and header were left uninitialized if request did not contain header field. Initialize both before decoding request. Assisted-by: Claude:claude-opus-5-5 --- omp/src/omp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/omp/src/omp.c b/omp/src/omp.c index fb1cc1e..5dedf3c 100644 --- a/omp/src/omp.c +++ b/omp/src/omp.c @@ -78,7 +78,7 @@ omp_send_err_rsp(struct CborEncoder *enc, int omp_read_hdr(struct CborValue *cv, struct mgmt_hdr *out_hdr) { - size_t hlen; + size_t hlen = 0; int rc; struct cbor_attr_t attrs[] = { @@ -93,6 +93,8 @@ omp_read_hdr(struct CborValue *cv, struct mgmt_hdr *out_hdr) [1] = { 0 } }; + memset(out_hdr, 0, sizeof(*out_hdr)); + rc = cbor_read_object(cv, attrs); if (rc != 0 || hlen != sizeof *out_hdr) { return MGMT_ERR_EINVAL;
