1
0
Fork 0
mirror of https://github.com/anrieff/libcpuid synced 2024-11-20 23:01:51 +00:00

Fix strings truncation warnings

recog_arm.c: In function 'cpuid_identify_arm':
recog_arm.c:2548:9: warning: 'strncpy' specified bound 16 equals destination size [-Wstringop-truncation]
 2548 |         strncpy(data->vendor_str,   hw_impl->name,     VENDOR_STR_MAX);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
recog_arm.c:2549:9: warning: 'strncpy' specified bound 64 equals destination size [-Wstringop-truncation]
 2549 |         strncpy(data->brand_str,    id_part->name,     BRAND_STR_MAX);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
recog_arm.c:2550:9: warning: 'strncpy' specified bound 64 equals destination size [-Wstringop-truncation]
 2550 |         strncpy(data->cpu_codename, id_part->codename, CODENAME_STR_MAX);
This commit is contained in:
The Tumultuous Unicorn Of Darkness 2024-08-25 16:05:11 +02:00
parent 656ea52909
commit 0d8cf47ee4
No known key found for this signature in database
GPG key ID: 1E55EE2EFF18BC1A

View file

@ -2545,9 +2545,9 @@ int cpuid_identify_arm(struct cpu_raw_data_t* raw, struct cpu_id_t* data)
const struct arm_hw_impl* hw_impl = get_cpu_implementer_from_code(data->arm.implementer);
const struct arm_id_part* id_part = get_cpu_implementer_parts(hw_impl, data->arm.part_num);
data->vendor = hw_impl->vendor;
strncpy(data->vendor_str, hw_impl->name, VENDOR_STR_MAX);
strncpy(data->brand_str, id_part->name, BRAND_STR_MAX);
strncpy(data->cpu_codename, id_part->codename, CODENAME_STR_MAX);
snprintf(data->vendor_str, VENDOR_STR_MAX, "%s", hw_impl->name);
snprintf(data->brand_str, BRAND_STR_MAX, "%s", id_part->name);
snprintf(data->cpu_codename, CODENAME_STR_MAX,"%s", id_part->codename);
use_cpuid_scheme = (decode_arm_architecture_version_by_midr(raw, data) == false);
load_arm_features(raw, data, &ext_status);
if (use_cpuid_scheme)