Skip to content

Commit 7cbe361

Browse files
weeTikenordicjm
authored andcommitted
[nrf fromtree] ipc: ipc_service: Null terminate RPMsg endpoint names
This fixes the compiler warning -Wstringop-truncation in version 13 of gcc. Signed-off-by: Timothy Keys <[email protected]> (cherry picked from commit 614f55f)
1 parent a2eaddb commit 7cbe361

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

subsys/ipc/ipc_service/backends/ipc_rpmsg_static_vrings.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ static void ns_bind_cb(struct rpmsg_device *rdev, const char *name, uint32_t des
201201
* call by the HOST core.
202202
*/
203203
strncpy(rpmsg_ept->name, name, sizeof(rpmsg_ept->name));
204+
rpmsg_ept->name[RPMSG_NAME_SIZE - 1] = '\0';
204205
rpmsg_ept->dest = dest;
205206
k_mutex_unlock(&rpmsg_inst->mtx);
206207
}
@@ -403,6 +404,7 @@ static struct ipc_rpmsg_ept *register_ept_on_host(struct ipc_rpmsg_instance *rpm
403404
* not registered the endpoint yet. Cache it.
404405
*/
405406
strncpy(rpmsg_ept->name, cfg->name, sizeof(rpmsg_ept->name));
407+
rpmsg_ept->name[RPMSG_NAME_SIZE - 1] = '\0';
406408
k_mutex_unlock(&rpmsg_inst->mtx);
407409
}
408410

@@ -426,6 +428,7 @@ static struct ipc_rpmsg_ept *register_ept_on_remote(struct ipc_rpmsg_instance *r
426428
rpmsg_ept->ep.priv = rpmsg_ept;
427429

428430
strncpy(rpmsg_ept->name, cfg->name, sizeof(rpmsg_ept->name));
431+
rpmsg_ept->name[RPMSG_NAME_SIZE - 1] = '\0';
429432

430433
err = ipc_rpmsg_register_ept(rpmsg_inst, RPMSG_REMOTE, rpmsg_ept);
431434
if (err != 0) {

0 commit comments

Comments
 (0)