Skip to content

[nrf fromtree] ipc: ipc_service: Null terminate RPMsg endpoint names #2442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions subsys/ipc/ipc_service/backends/ipc_rpmsg_static_vrings.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ static void ns_bind_cb(struct rpmsg_device *rdev, const char *name, uint32_t des
* call by the HOST core.
*/
strncpy(rpmsg_ept->name, name, sizeof(rpmsg_ept->name));
rpmsg_ept->name[RPMSG_NAME_SIZE - 1] = '\0';
rpmsg_ept->dest = dest;
k_mutex_unlock(&rpmsg_inst->mtx);
}
Expand Down Expand Up @@ -403,6 +404,7 @@ static struct ipc_rpmsg_ept *register_ept_on_host(struct ipc_rpmsg_instance *rpm
* not registered the endpoint yet. Cache it.
*/
strncpy(rpmsg_ept->name, cfg->name, sizeof(rpmsg_ept->name));
rpmsg_ept->name[RPMSG_NAME_SIZE - 1] = '\0';
k_mutex_unlock(&rpmsg_inst->mtx);
}

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

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

err = ipc_rpmsg_register_ept(rpmsg_inst, RPMSG_REMOTE, rpmsg_ept);
if (err != 0) {
Expand Down
Loading