out.alignment = device_info.alignment;
out.alignment_offset = device_info.alignment_offset;
out.size = device_info.size;
- if (device_info.partition_name.size() > sizeof(out.partition_name)) {
+ if (device_info.partition_name.size() >= sizeof(out.partition_name)) {
LERROR << "Partition name " << device_info.partition_name << " exceeds maximum length.";
return false;
}
- strncpy(out.partition_name, device_info.partition_name.c_str(), sizeof(out.partition_name));
+ strncpy(out.partition_name, device_info.partition_name.c_str(), device_info.partition_name.size());
// In the case of the super partition, this field will be adjusted
// later. For all partitions, the first 512 bytes are considered