mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-08 10:04:42 +00:00
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:
@@ -823,7 +823,7 @@ virtio_net_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
|
||||
dev->func, mac_seed);
|
||||
|
||||
MD5_Init(&mdctx);
|
||||
MD5_Update(&mdctx, nstr, strlen(nstr));
|
||||
MD5_Update(&mdctx, nstr, strnlen(nstr, sizeof(nstr)));
|
||||
MD5_Final(digest, &mdctx);
|
||||
|
||||
net->config.mac[0] = 0x00;
|
||||
|
||||
@@ -501,6 +501,7 @@ static int pci_xhci_parse_log_level(struct pci_xhci_vdev *xdev, char *opts);
|
||||
static int pci_xhci_parse_extcap(struct pci_xhci_vdev *xdev, char *opts);
|
||||
static int pci_xhci_convert_speed(int lspeed);
|
||||
|
||||
#define XHCI_OPT_MAX_LEN 32
|
||||
static struct pci_xhci_option_elem xhci_option_table[] = {
|
||||
{"tablet", pci_xhci_parse_tablet},
|
||||
{"log", pci_xhci_parse_log_level},
|
||||
@@ -3985,7 +3986,7 @@ pci_xhci_parse_opts(struct pci_xhci_vdev *xdev, char *opts)
|
||||
if (!n || !f)
|
||||
continue;
|
||||
|
||||
if (!strncmp(t, n, strlen(n))) {
|
||||
if (!strncmp(t, n, strnlen(n, XHCI_OPT_MAX_LEN))) {
|
||||
f(xdev, t);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user