diff options
author | Sudeep Holla <sudeep.holla@arm.com> | 2018-09-07 18:03:25 +0200 |
---|---|---|
committer | Sudeep Holla <sudeep.holla@arm.com> | 2018-09-10 11:08:44 +0200 |
commit | ca64b719a1e665ac7449b6a968059176af7365a8 (patch) | |
tree | e23723188ee72525bb6e5ccbbc9f465e167c3a1b /drivers/firmware/arm_scmi/clock.c | |
parent | Linux 4.19-rc3 (diff) | |
download | linux-ca64b719a1e665ac7449b6a968059176af7365a8.tar.xz linux-ca64b719a1e665ac7449b6a968059176af7365a8.zip |
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/clock.c')
-rw-r--r-- | drivers/firmware/arm_scmi/clock.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c index e4119eb34986..30fc04e28431 100644 --- a/drivers/firmware/arm_scmi/clock.c +++ b/drivers/firmware/arm_scmi/clock.c @@ -111,7 +111,7 @@ static int scmi_clock_attributes_get(const struct scmi_handle *handle, ret = scmi_do_xfer(handle, t); if (!ret) - memcpy(clk->name, attr->name, SCMI_MAX_STR_SIZE); + strlcpy(clk->name, attr->name, SCMI_MAX_STR_SIZE); else clk->name[0] = '\0'; |