diff options
author | Sudeep Holla <sudeep.holla@arm.com> | 2018-09-07 19:03:25 +0300 |
---|---|---|
committer | Sudeep Holla <sudeep.holla@arm.com> | 2018-09-10 12:08:44 +0300 |
commit | ca64b719a1e665ac7449b6a968059176af7365a8 (patch) | |
tree | e23723188ee72525bb6e5ccbbc9f465e167c3a1b /drivers/firmware/arm_scmi/base.c | |
parent | 11da3a7f84f19c26da6f86af878298694ede0804 (diff) | |
download | linux-ca64b719a1e665ac7449b6a968059176af7365a8.tar.xz |
firmware: arm_scmi: use strlcpy to ensure NULL-terminated strings
Replace all the memcpy() for copying name strings from the firmware with
strlcpy() to make sure we are bounded by the source buffer size and we
also always have NULL-terminated strings.
This is needed to avoid out of bounds accesses if the firmware returns
a non-terminated string.
Reported-by: Olof Johansson <olof@lixom.net>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Diffstat (limited to 'drivers/firmware/arm_scmi/base.c')
-rw-r--r-- | drivers/firmware/arm_scmi/base.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/firmware/arm_scmi/base.c b/drivers/firmware/arm_scmi/base.c index 9dff33ea6416..204390297f4b 100644 --- a/drivers/firmware/arm_scmi/base.c +++ b/drivers/firmware/arm_scmi/base.c @@ -208,7 +208,7 @@ static int scmi_base_discover_agent_get(const struct scmi_handle *handle, ret = scmi_do_xfer(handle, t); if (!ret) - memcpy(name, t->rx.buf, SCMI_MAX_STR_SIZE); + strlcpy(name, t->rx.buf, SCMI_MAX_STR_SIZE); scmi_xfer_put(handle, t); |