mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-24 06:29:19 +00:00
dm: use strnlen to replace strlen
Replace strlen function with strnlen function in DM Tracked-On: #3276 Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
parent
5ced5fe77f
commit
b65489c27d
@ -647,10 +647,10 @@ virtio_gpio_proc(struct virtio_gpio *gpio, struct iovec *iov, int n)
|
|||||||
* command line paremeter, then provide it to UOS,
|
* command line paremeter, then provide it to UOS,
|
||||||
* otherwise provide the physical name of gpio to UOS.
|
* otherwise provide the physical name of gpio to UOS.
|
||||||
*/
|
*/
|
||||||
if (strlen(line->vname))
|
if (strnlen(line->vname, sizeof(line->vname)))
|
||||||
strncpy(data[i].name, line->vname,
|
strncpy(data[i].name, line->vname,
|
||||||
sizeof(data[0].name) - 1);
|
sizeof(data[0].name) - 1);
|
||||||
else if (strlen(line->name))
|
else if (strnlen(line->name, sizeof(line->name)))
|
||||||
strncpy(data[i].name, line->name,
|
strncpy(data[i].name, line->name,
|
||||||
sizeof(data[0].name) - 1);
|
sizeof(data[0].name) - 1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user