mb/prodrive/hermes: Use `snprintf()` to handle strings
Strings in C are highly cursed. Use `snprintf()` to minimize the potential of running into undefined behavior in the future. Change-Id: I3caef25bc7676ac84bb1c40efe6d16f50f8f4d26 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/68323 Reviewed-by: Patrick Georgi <patrick@coreboot.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <felixsinger@posteo.net>
This commit is contained in:
parent
cdc156ebd1
commit
bf541422e9
|
@ -178,9 +178,7 @@ static const char *format_pn(const char *prefix, size_t offset)
|
||||||
|
|
||||||
const char *part_num = eeprom_read_serial(offset, "N/A");
|
const char *part_num = eeprom_read_serial(offset, "N/A");
|
||||||
|
|
||||||
memset(buffer, 0, sizeof(buffer));
|
snprintf(buffer, sizeof(buffer), "%s%s", prefix, part_num);
|
||||||
strcpy(buffer, prefix);
|
|
||||||
strcpy(buffer + strlen(prefix), part_num);
|
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue