From 205179d0c02cb3f59eda77d3e6cc895b7d4b06bd Mon Sep 17 00:00:00 2001 From: Chen Gang Date: Fri, 26 Apr 2013 18:31:58 +0800 Subject: [PATCH] staging: wlags49_h2: strncpy, need checking the memory length HCF_MAX_NAME_LEN is 32, which may less than ''probe_rsp->rawData[1]'', so need check the length when copy to ssid. Signed-off-by: Chen Gang Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlags49_h2/wl_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/wlags49_h2/wl_main.c b/drivers/staging/wlags49_h2/wl_main.c index f28f15baea96..35d617d0792d 100644 --- a/drivers/staging/wlags49_h2/wl_main.c +++ b/drivers/staging/wlags49_h2/wl_main.c @@ -3171,7 +3171,8 @@ void wl_process_mailbox( struct wl_private *lp ) memset( ssid, 0, sizeof( ssid )); strncpy( ssid, &probe_rsp->rawData[2], - probe_rsp->rawData[1] ); + min(probe_rsp->rawData[1], + HCF_MAX_NAME_LEN - 1)); DBG_TRACE( DbgInfo, "(%s) SSID : %s\n", lp->dev->name, ssid ); -- 2.20.1