Angel Pons has submitted this change. ( https://review.coreboot.org/c/coreboot/+/57013 )
Change subject: device_util.c: Replace `memcpy()` with `strcpy()` ......................................................................
device_util.c: Replace `memcpy()` with `strcpy()`
Use `strcpy()` instead of `memcpy()` to copy string literals.
Change-Id: I8ebf591e3348d992739ed7cc2e4015aa650f115a Signed-off-by: Angel Pons th3fanbus@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/57013 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Nico Huber nico.h@gmx.de Reviewed-by: Felix Held felix-coreboot@felixheld.de --- M src/device/device_util.c 1 file changed, 3 insertions(+), 3 deletions(-)
Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved Felix Held: Looks good to me, approved
diff --git a/src/device/device_util.c b/src/device/device_util.c index 9e71287..7b72a94 100644 --- a/src/device/device_util.c +++ b/src/device/device_util.c @@ -152,14 +152,14 @@
buffer[0] = '\0'; if (!dev) { - memcpy(buffer, "<null>", 7); + strcpy(buffer, "<null>"); } else { switch (dev->path.type) { case DEVICE_PATH_NONE: - memcpy(buffer, "NONE", 5); + strcpy(buffer, "NONE"); break; case DEVICE_PATH_ROOT: - memcpy(buffer, "Root Device", 12); + strcpy(buffer, "Root Device"); break; case DEVICE_PATH_PCI: snprintf(buffer, sizeof(buffer),