diff options
author | Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> | 2020-08-03 12:54:46 +0100 |
---|---|---|
committer | Rui Miguel Silva <rui.silva@linaro.org> | 2020-08-03 14:31:58 +0100 |
commit | 41ef76951c5119729c1ea305406f74776da90866 (patch) | |
tree | 5c6bae98f717a9f102326b499125120d870012cc | |
parent | 211f64282cde60e87eb030500cb8ebbd03eba328 (diff) |
openamp: fixing buffer overflow in rpmsg_init_ept functionCORSTONE-700-2020.12.10
GCC detects that in the rpmsg_init_ept function ept->name
string NULL character may be overriden by strncpy.
This could cause a buffer overflow (stringop-truncation warning).
This commit fixes this issue.
Change-Id: I74a890589e63d5c192cd8ac597f51b3d80a2dc39
Signed-off-by: Lakshmi Kailasanathan <lakshmi.kailasanathan@arm.com>
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
-rw-r--r-- | framework/include/openamp/rpmsg.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/framework/include/openamp/rpmsg.h b/framework/include/openamp/rpmsg.h index 6e4fbcd..753ac7c 100644 --- a/framework/include/openamp/rpmsg.h +++ b/framework/include/openamp/rpmsg.h @@ -285,6 +285,8 @@ static inline void rpmsg_init_ept(struct rpmsg_endpoint *ept, rpmsg_ns_unbind_cb ns_unbind_cb) { strncpy(ept->name, name, sizeof(ept->name)); + ept->name[sizeof(ept->name)-1]='\0'; + ept->addr = src; ept->dest_addr = dest; ept->cb = cb; |