From: Phillip Simbwa Date: Wed, 29 Dec 2010 20:01:16 +0000 (-0800) Subject: Staging: ath6kl: fix potential buffer overflow X-Git-Tag: v2.6.38-rc3~8^2~21 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=64911e4b133ff633563d6dd2b021fa1ca0608992;p=karo-tx-linux.git Staging: ath6kl: fix potential buffer overflow Off by one Signed-off-by: Phillip Simbwa Signed-off-by: Vipin Mehta Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c index 0e298dba9fc8..29b8ab44ea47 100644 --- a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c +++ b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c @@ -360,8 +360,8 @@ int PSSendOps(void *arg) status = 1; goto complete; } - len = (firmware->size > MAX_BDADDR_FORMAT_LENGTH)? MAX_BDADDR_FORMAT_LENGTH: firmware->size; - memcpy(config_bdaddr, firmware->data,len); + len = min(firmware->size, MAX_BDADDR_FORMAT_LENGTH - 1); + memcpy(config_bdaddr, firmware->data, len); config_bdaddr[len] = '\0'; write_bdaddr(hdev,config_bdaddr,BDADDR_TYPE_STRING); A_RELEASE_FIRMWARE(firmware);