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:
parent
656ea52909
commit
0d8cf47ee4
1 changed files with 3 additions and 3 deletions
|
@ -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_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);
|
const struct arm_id_part* id_part = get_cpu_implementer_parts(hw_impl, data->arm.part_num);
|
||||||
data->vendor = hw_impl->vendor;
|
data->vendor = hw_impl->vendor;
|
||||||
strncpy(data->vendor_str, hw_impl->name, VENDOR_STR_MAX);
|
snprintf(data->vendor_str, VENDOR_STR_MAX, "%s", hw_impl->name);
|
||||||
strncpy(data->brand_str, id_part->name, BRAND_STR_MAX);
|
snprintf(data->brand_str, BRAND_STR_MAX, "%s", id_part->name);
|
||||||
strncpy(data->cpu_codename, id_part->codename, CODENAME_STR_MAX);
|
snprintf(data->cpu_codename, CODENAME_STR_MAX,"%s", id_part->codename);
|
||||||
use_cpuid_scheme = (decode_arm_architecture_version_by_midr(raw, data) == false);
|
use_cpuid_scheme = (decode_arm_architecture_version_by_midr(raw, data) == false);
|
||||||
load_arm_features(raw, data, &ext_status);
|
load_arm_features(raw, data, &ext_status);
|
||||||
if (use_cpuid_scheme)
|
if (use_cpuid_scheme)
|
||||||
|
|
Loading…
Reference in a new issue