diff options
author | Niklas Cassel <niklas.cassel@linaro.org> | 2018-08-29 09:57:21 +0200 |
---|---|---|
committer | Andy Gross <andy.gross@linaro.org> | 2018-09-13 16:11:36 -0500 |
commit | 4c96ed170d658d8826d94edec8ac93ee777981a2 (patch) | |
tree | 343f7788d4494f31c60b103cbc0d91cce7d03da1 /drivers/soc/qcom | |
parent | c62615b16c70db8f5e55e326f6d690909afc510f (diff) | |
download | linux-stable-4c96ed170d658d8826d94edec8ac93ee777981a2.tar.gz linux-stable-4c96ed170d658d8826d94edec8ac93ee777981a2.tar.bz2 linux-stable-4c96ed170d658d8826d94edec8ac93ee777981a2.zip |
soc: qcom: wcnss_ctrl: Avoid string overflow
'chinfo.name' is used as a NUL-terminated string, but using strncpy() with
the length equal to the buffer size may result in lack of the termination:
drivers//soc/qcom/wcnss_ctrl.c: In function 'qcom_wcnss_open_channel':
drivers//soc/qcom/wcnss_ctrl.c:284:2: warning: 'strncpy' specified bound 32 equals destination size [-Wstringop-truncation]
strncpy(chinfo.name, name, sizeof(chinfo.name));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This changes it to use the safer strscpy() instead.
Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Andy Gross <andy.gross@linaro.org>
Diffstat (limited to 'drivers/soc/qcom')
-rw-r--r-- | drivers/soc/qcom/wcnss_ctrl.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/soc/qcom/wcnss_ctrl.c b/drivers/soc/qcom/wcnss_ctrl.c index df3ccb30bc2d..373400dd816d 100644 --- a/drivers/soc/qcom/wcnss_ctrl.c +++ b/drivers/soc/qcom/wcnss_ctrl.c @@ -281,7 +281,7 @@ struct rpmsg_endpoint *qcom_wcnss_open_channel(void *wcnss, const char *name, rp struct rpmsg_channel_info chinfo; struct wcnss_ctrl *_wcnss = wcnss; - strncpy(chinfo.name, name, sizeof(chinfo.name)); + strscpy(chinfo.name, name, sizeof(chinfo.name)); chinfo.src = RPMSG_ADDR_ANY; chinfo.dst = RPMSG_ADDR_ANY; |