diff --git a/subsys/mgmt/smp.c b/subsys/mgmt/smp.c index 0cdc9dd7f10..233f11c0101 100644 --- a/subsys/mgmt/smp.c +++ b/subsys/mgmt/smp.c @@ -148,7 +148,7 @@ zephyr_smp_write_at(struct cbor_encoder_writer *writer, size_t offset, return MGMT_ERR_EINVAL; } - if (len > net_buf_tailroom(nb)) { + if ((offset + len) > (nb->size - net_buf_headroom(nb))) { return MGMT_ERR_EINVAL; }