From: Arend van Spriel Date: Thu, 13 Sep 2012 19:12:05 +0000 (+0200) Subject: brcmfmac: add parameter check in brcmf_c_mkiovar() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4f6e1cafe25df11f4c8afe5d6a3ee051aa6d5de3;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git brcmfmac: add parameter check in brcmf_c_mkiovar() This patch assures data is only appended in output buffer when data is not NULL and datalen is not zero. Reviewed-by: Hante Meuleman Reviewed-by: Pieter-Paul Giesberts Signed-off-by: Arend van Spriel Signed-off-by: John W. Linville --- diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c index f6b862d77986..c45270a2a1d9 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c @@ -80,8 +80,10 @@ brcmf_c_mkiovar(char *name, char *data, uint datalen, char *buf, uint buflen) strncpy(buf, name, buflen); /* append data onto the end of the name string */ - memcpy(&buf[len], data, datalen); - len += datalen; + if (data && datalen) { + memcpy(&buf[len], data, datalen); + len += datalen; + } return len; }