rtl8188eu: Fix smatch warnings in core/rtw_cmd.c

Smatch reports the following warnings:
  CHECK   /home/finger/rtl8188eu/core/rtw_cmd.c
/home/finger/rtl8188eu/core/rtw_cmd.c:385 rtw_cmd_thread() error: buffer overflow 'wlancmds' 63 <= 63
/home/finger/rtl8188eu/core/rtw_cmd.c:403 rtw_cmd_thread() error: buffer overflow 'rtw_cmd_callback' 63 <= 63

These are caused by an off-by-one error using <= rather than <.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2013-09-05 12:03:09 -05:00
parent ccd4c72b62
commit 4769256ac2

View file

@ -381,7 +381,7 @@ _next:
_rtw_memcpy(pcmdbuf, pcmd->parmbuf, pcmd->cmdsz);
if (pcmd->cmdcode <= (sizeof(wlancmds) / sizeof(struct cmd_hdl))) {
if (pcmd->cmdcode < (sizeof(wlancmds) / sizeof(struct cmd_hdl))) {
cmd_hdl = wlancmds[pcmd->cmdcode].h2cfuns;
if (cmd_hdl) {
@ -399,7 +399,7 @@ _next:
post_process:
/* call callback function for post-processed */
if (pcmd->cmdcode <= (sizeof(rtw_cmd_callback) / sizeof(struct _cmd_callback))) {
if (pcmd->cmdcode < (sizeof(rtw_cmd_callback) / sizeof(struct _cmd_callback))) {
pcmd_callback = rtw_cmd_callback[pcmd->cmdcode].callback;
if (pcmd_callback == NULL) {
RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("mlme_cmd_hdl(): pcmd_callback = 0x%p, cmdcode = 0x%x\n", pcmd_callback, pcmd->cmdcode));