dm: use strnlen to replace strlen

Tracked-On: #2133
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
This commit is contained in:
Shuo A Liu
2018-12-25 10:33:36 +08:00
committed by wenlingz
parent ff2ed240a0
commit 0bb20c3812
14 changed files with 27 additions and 25 deletions

View File

@@ -59,6 +59,7 @@ enum {
UMSTR_MAX
};
#define UMOUSE_DESC_MAX_LEN 32
static const char *const umouse_desc_strings[] = {
"\x04\x09",
"ACRN-DM",
@@ -437,7 +438,7 @@ umouse_request(void *scarg, struct usb_data_xfer *xfer)
goto done;
}
slen = 2 + strlen(str) * 2;
slen = 2 + strnlen(str, UMOUSE_DESC_MAX_LEN) * 2;
udata[0] = slen;
udata[1] = UDESC_STRING;