Skip to content
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

Fix safe_strcpy calls #626

Merged
merged 2 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion lib/include/openamp/remoteproc.h
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ int remoteproc_remove(struct remoteproc *rproc);
* @brief Initialize remoteproc memory
*
* @param mem Pointer to remoteproc memory
* @param name Memory name
* @param name Memory name (max string size \ref RPROC_MAX_NAME_LEN)
* @param pa Physical address
* @param da Device address
* @param size Memory size
Expand Down
2 changes: 1 addition & 1 deletion lib/include/openamp/rpmsg.h
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ static inline int rpmsg_send_nocopy(struct rpmsg_endpoint *ept,
*
* @param ept Pointer to rpmsg endpoint
* @param rdev RPMsg device associated with the endpoint
* @param name Service name associated to the endpoint
* @param name Service name associated to the endpoint (maximum size \ref RPMSG_NAME_SIZE)
* @param src Local address of the endpoint
* @param dest Target address of the endpoint
* @param cb Endpoint callback
Expand Down
2 changes: 1 addition & 1 deletion lib/remoteproc/remoteproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ void remoteproc_init_mem(struct remoteproc_mem *mem, const char *name,
if (!mem || !io || size == 0)
return;
if (name)
(void)safe_strcpy(mem->name, sizeof(mem->name), name, sizeof(name));
(void)safe_strcpy(mem->name, sizeof(mem->name), name, RPROC_MAX_NAME_LEN);
else
mem->name[0] = 0;
mem->pa = pa;
Expand Down
4 changes: 2 additions & 2 deletions lib/rpmsg/rpmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ int rpmsg_send_ns_message(struct rpmsg_endpoint *ept, unsigned long flags)

ns_msg.flags = flags;
ns_msg.addr = ept->addr;
(void)safe_strcpy(ns_msg.name, sizeof(ns_msg.name), ept->name, strlen(ept->name));
(void)safe_strcpy(ns_msg.name, sizeof(ns_msg.name), ept->name, sizeof(ept->name));
ret = rpmsg_send_offchannel_raw(ept, ept->addr,
RPMSG_NS_EPT_ADDR,
&ns_msg, sizeof(ns_msg), true);
Expand Down Expand Up @@ -307,7 +307,7 @@ void rpmsg_register_endpoint(struct rpmsg_device *rdev,
rpmsg_ns_unbind_cb ns_unbind_cb, void *priv)
{
if (name)
(void)safe_strcpy(ept->name, sizeof(ept->name), name, sizeof(name));
(void)safe_strcpy(ept->name, sizeof(ept->name), name, RPMSG_NAME_SIZE);
else
ept->name[0] = 0;

Expand Down