summaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorPhillip Simbwa <simbwa@gmail.com>2010-12-29 12:01:16 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2011-01-20 12:01:23 -0800
commit64911e4b133ff633563d6dd2b021fa1ca0608992 (patch)
tree43b4983c00f37ae8bf3bfc8531fdbe5c352fa6ef /drivers/staging
parenta786f915274ba446865a996515c7790a930f04dd (diff)
downloadlinux-64911e4b133ff633563d6dd2b021fa1ca0608992.tar.bz2
Staging: ath6kl: fix potential buffer overflow
Off by one Signed-off-by: Phillip Simbwa <simbwa at gmail dot com> Signed-off-by: Vipin Mehta <vmehta@atheros.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c4
1 files changed, 2 insertions, 2 deletions
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);