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>
This commit is contained in:
Angel Pons 2021-08-18 08:32:45 +02:00
parent 81d5a25fbb
commit d7df383342
1 changed files with 3 additions and 3 deletions

View File

@ -152,14 +152,14 @@ const char *dev_path(const struct device *dev)
buffer[0] = '\0'; buffer[0] = '\0';
if (!dev) { if (!dev) {
memcpy(buffer, "<null>", 7); strcpy(buffer, "<null>");
} else { } else {
switch (dev->path.type) { switch (dev->path.type) {
case DEVICE_PATH_NONE: case DEVICE_PATH_NONE:
memcpy(buffer, "NONE", 5); strcpy(buffer, "NONE");
break; break;
case DEVICE_PATH_ROOT: case DEVICE_PATH_ROOT:
memcpy(buffer, "Root Device", 12); strcpy(buffer, "Root Device");
break; break;
case DEVICE_PATH_PCI: case DEVICE_PATH_PCI:
snprintf(buffer, sizeof(buffer), snprintf(buffer, sizeof(buffer),