Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <gang.chen@asianux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Chen Gang and committed by
Greg Kroah-Hartman
205179d0 a85fd2c8

+2 -1
+2 -1
drivers/staging/wlags49_h2/wl_main.c
··· 3171 3171 3172 3172 memset( ssid, 0, sizeof( ssid )); 3173 3173 strncpy( ssid, &probe_rsp->rawData[2], 3174 - probe_rsp->rawData[1] ); 3174 + min(probe_rsp->rawData[1], 3175 + HCF_MAX_NAME_LEN - 1)); 3175 3176 3176 3177 DBG_TRACE( DbgInfo, "(%s) SSID : %s\n", 3177 3178 lp->dev->name, ssid );