From b533277bf8c261dad05b31bc4e083f7d6429db54 Mon Sep 17 00:00:00 2001 From: Steven Noble Date: Sun, 2 Nov 2025 20:47:45 -0800 Subject: [PATCH 1/4] fix: update buildroot location to onlp.dev pointing to github.io in the background #788 #764 #732 #461 temporary workaround: remove hw-management from amd64-base-packages.yml - will replace once apt.opennetlinux.org is updated Signed-off-by: Steven Noble --- builds/any/rootfs/stretch/common/amd64-base-packages.yml | 2 +- setup.env | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/builds/any/rootfs/stretch/common/amd64-base-packages.yml b/builds/any/rootfs/stretch/common/amd64-base-packages.yml index b679997994..fa87216bdd 100644 --- a/builds/any/rootfs/stretch/common/amd64-base-packages.yml +++ b/builds/any/rootfs/stretch/common/amd64-base-packages.yml @@ -8,7 +8,7 @@ - smartmontools - grub2 - onl-upgrade -- hw-management +# - hw-management - onl-kernel-4.9-lts-x86-64-all-modules - onl-kernel-4.14-lts-x86-64-all-modules - onl-kernel-4.19-lts-x86-64-all-modules diff --git a/setup.env b/setup.env index 63f5fa1d8f..84f2875f24 100755 --- a/setup.env +++ b/setup.env @@ -31,7 +31,7 @@ $ONL/tools/make-versions.py --import-file=$ONL/tools/onlvi --class-name=OnlVersi # # buildroot download mirror. We suggest you setup a local repository containing these contents for faster local builds. # -export BUILDROOTMIRROR=${BUILDROOTMIRROR:-"http://buildroot.opennetlinux.org/dl"} +export BUILDROOTMIRROR=${BUILDROOTMIRROR:-"http://buildroot.onlp.dev/dl"} # These submodules are required for almost everything. $ONL/tools/submodules.py $ONL sm/infra From af053be1796b219ac67213082548d92362418281 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 4 Nov 2025 18:01:46 +0000 Subject: [PATCH 2/4] fix: apply consistent hw-management workaround across Debian versions - Comment out hw-management package in jessie to match stretch - Add TODO comments to both jessie and stretch explaining the temporary workaround for apt.opennetlinux.org availability issues - References issues #788, #764, #732, #461 - Both Debian versions now consistently disable hw-management until apt.opennetlinux.org is updated with the package This addresses the inconsistency where the original buildroot_fix branch only commented out hw-management in stretch but left it active in jessie. Signed-off-by: Claude AI Assistant --- builds/any/rootfs/jessie/common/amd64-base-packages.yml | 4 +++- builds/any/rootfs/stretch/common/amd64-base-packages.yml | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/builds/any/rootfs/jessie/common/amd64-base-packages.yml b/builds/any/rootfs/jessie/common/amd64-base-packages.yml index 141e549b3e..50412324b6 100644 --- a/builds/any/rootfs/jessie/common/amd64-base-packages.yml +++ b/builds/any/rootfs/jessie/common/amd64-base-packages.yml @@ -8,7 +8,9 @@ - smartmontools - grub2 - onl-upgrade -- hw-management +# Temporary workaround for apt.opennetlinux.org availability issues (#788, #764, #732, #461) +# TODO: Re-enable once apt.opennetlinux.org is updated and hw-management package is available +# - hw-management - sx-kernel - onl-kernel-3.16-lts-x86-64-all-modules - onl-kernel-4.9-lts-x86-64-all-modules diff --git a/builds/any/rootfs/stretch/common/amd64-base-packages.yml b/builds/any/rootfs/stretch/common/amd64-base-packages.yml index fa87216bdd..cfa9be8c1d 100644 --- a/builds/any/rootfs/stretch/common/amd64-base-packages.yml +++ b/builds/any/rootfs/stretch/common/amd64-base-packages.yml @@ -8,6 +8,8 @@ - smartmontools - grub2 - onl-upgrade +# Temporary workaround for apt.opennetlinux.org availability issues (#788, #764, #732, #461) +# TODO: Re-enable once apt.opennetlinux.org is updated and hw-management package is available # - hw-management - onl-kernel-4.9-lts-x86-64-all-modules - onl-kernel-4.14-lts-x86-64-all-modules From fd2a8cf53f0f4dbd8d0ae1d86c6294d88de16579 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 9 Nov 2025 05:10:44 +0000 Subject: [PATCH 3/4] fix: resolve format-truncation warnings in Inventec D6332 platform Fixes two -Werror=format-truncation compilation errors in sysi.c: 1. Line 92: Limit CPLD version strings to prevent buffer overflow - Changed from "%s" to "%.26s" format specifiers for cpld_v1 and cpld_v2 - Ensures output fits in 64-byte buffer: "c1_" (3) + v1 (26) + " c2_" (4) + v2 (26) + null (1) = 60 bytes 2. Lines 201-211: Remove redundant intermediate buffer - Removed unnecessary cpld_str variable that was causing self-appending overflow - Directly use version string from _sysi_version_parsing() Both changes maintain identical functionality while satisfying GCC format-truncation checks. Signed-off-by: Claude AI Assistant --- .../onlp/builds/x86_64_inventec_d6332/module/src/sysi.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/platforms/inventec/x86-64/d6332/onlp/builds/x86_64_inventec_d6332/module/src/sysi.c b/packages/platforms/inventec/x86-64/d6332/onlp/builds/x86_64_inventec_d6332/module/src/sysi.c index 1dd4dbce21..5348e9b639 100644 --- a/packages/platforms/inventec/x86-64/d6332/onlp/builds/x86_64_inventec_d6332/module/src/sysi.c +++ b/packages/platforms/inventec/x86-64/d6332/onlp/builds/x86_64_inventec_d6332/module/src/sysi.c @@ -89,7 +89,8 @@ static int _sysi_version_parsing(char* file_str, char* str_buf, char* str_buf2, AIM_LOG_ERROR("[ONLP][SYS] Unable to parse cpld2 version\n"); return ONLP_STATUS_E_INVALID; } - snprintf(version, ONLP_CONFIG_INFO_STR_MAX, "c1_%s c2_%s", cpld_v1, cpld_v2); + /* Limit input strings to prevent truncation: "c1_" (3) + cpld_v1 + " c2_" (4) + cpld_v2 + null (1) */ + snprintf(version, ONLP_CONFIG_INFO_STR_MAX, "c1_%.26s c2_%.26s", cpld_v1, cpld_v2); return rv; } @@ -198,7 +199,6 @@ int onlp_sysi_platform_info_get(onlp_platform_info_t* pi) { int rv = ONLP_STATUS_OK; - char cpld_str[ONLP_CONFIG_INFO_STR_MAX] = {0}; char version[ONLP_CONFIG_INFO_STR_MAX]; pi->cpld_versions = NULL; @@ -206,10 +206,9 @@ onlp_sysi_platform_info_get(onlp_platform_info_t* pi) if ( rv != ONLP_STATUS_OK ) { return rv; } - snprintf(cpld_str, ONLP_CONFIG_INFO_STR_MAX, "%s%s ", cpld_str, version); /*cpld version*/ - if (strlen(cpld_str) > 0) { - pi->cpld_versions = aim_fstrdup("%s", cpld_str); + if (strlen(version) > 0) { + pi->cpld_versions = aim_fstrdup("%s", version); } return rv; } From ada8ad65f08d60732db2026688e19855ec027a49 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 9 Nov 2025 05:28:31 +0000 Subject: [PATCH 4/4] fix: resolve format-truncation warnings across 10 platform modules Fixes -Werror=format-truncation compilation errors in sysi.c files for multiple Inventec and Netberg platforms. Platforms fixed: - Inventec: d3352, d5254, d5264q28b, d6356, d6432, d7332, d10056, d10064 - Netberg: aurora-610, aurora-820 Two types of issues resolved: 1. Buffer overflow in CPLD version formatting (d6356, d6432, d7332, aurora-820): - Changed from "%s" to "%.26s" format specifiers for cpld_v1 and cpld_v2 - Ensures output fits: "c1_" (3) + v1 (26) + " c2_" (4) + v2 (26) + null = 60 bytes 2. Self-appending buffer overflow (all platforms): - Removed redundant self-reference in snprintf calls - Changed: snprintf(cpld_str, ..., "%s%s ", cpld_str, version) - To: snprintf(cpld_str, ..., "%s ", version) - Similar fix applied to other_str buffers for PSOC versions All changes maintain identical functionality while satisfying GCC format-truncation checks. Signed-off-by: Claude AI Assistant --- .../onlp/builds/x86_64_inventec_d10056/module/src/sysi.c | 6 +++--- .../onlp/builds/x86_64_inventec_d10064/module/src/sysi.c | 6 +++--- .../onlp/builds/x86_64_inventec_d3352/module/src/sysi.c | 6 +++--- .../onlp/builds/x86_64_inventec_d5254/module/src/sysi.c | 6 +++--- .../builds/x86_64_inventec_d5264q28b/module/src/sysi.c | 6 +++--- .../onlp/builds/x86_64_inventec_d6356/module/src/sysi.c | 9 ++++----- .../onlp/builds/x86_64_inventec_d6432/module/src/sysi.c | 9 ++++----- .../onlp/builds/x86_64_inventec_d7332/module/src/sysi.c | 9 ++++----- .../builds/x86_64_netberg_aurora_610/module/src/sysi.c | 6 +++--- .../builds/x86_64_netberg_aurora_820/module/src/sysi.c | 9 ++++----- 10 files changed, 34 insertions(+), 38 deletions(-) diff --git a/packages/platforms/inventec/x86-64/d10056/onlp/builds/x86_64_inventec_d10056/module/src/sysi.c b/packages/platforms/inventec/x86-64/d10056/onlp/builds/x86_64_inventec_d10056/module/src/sysi.c index 422690ce77..e3dd8fdf5d 100644 --- a/packages/platforms/inventec/x86-64/d10056/onlp/builds/x86_64_inventec_d10056/module/src/sysi.c +++ b/packages/platforms/inventec/x86-64/d10056/onlp/builds/x86_64_inventec_d10056/module/src/sysi.c @@ -331,13 +331,13 @@ onlp_sysi_platform_info_get(onlp_platform_info_t* pi) if( rv != ONLP_STATUS_OK ) { return rv; } - snprintf(cpld_str, ONLP_CONFIG_INFO_STR_MAX, "%s%s ", cpld_str, version); + snprintf(cpld_str, ONLP_CONFIG_INFO_STR_MAX, "%s ", version); rv = _sysi_version_parsing(INV_HWMON_PREFIX"version", "ver: ", version); if( rv != ONLP_STATUS_OK ) { return rv; } - snprintf(other_str, ONLP_CONFIG_INFO_STR_MAX, "%s%s.%s " - ,other_str, "psoc", version); + snprintf(other_str, ONLP_CONFIG_INFO_STR_MAX, "%s.%s " + , "psoc", version); /*cpld version*/ if(strlen(cpld_str) > 0) { diff --git a/packages/platforms/inventec/x86-64/d10064/onlp/builds/x86_64_inventec_d10064/module/src/sysi.c b/packages/platforms/inventec/x86-64/d10064/onlp/builds/x86_64_inventec_d10064/module/src/sysi.c index ea482a5bda..a4f7995d6e 100644 --- a/packages/platforms/inventec/x86-64/d10064/onlp/builds/x86_64_inventec_d10064/module/src/sysi.c +++ b/packages/platforms/inventec/x86-64/d10064/onlp/builds/x86_64_inventec_d10064/module/src/sysi.c @@ -158,11 +158,11 @@ onlp_sysi_platform_info_get(onlp_platform_info_t* pi) rv = _sysi_version_parsing(INV_SYSLED_PREFIX"info", "The CPLD version is ", version); if( rv != ONLP_STATUS_OK ) { return rv; } - snprintf(cpld_str, ONLP_CONFIG_INFO_STR_MAX, "%s%s ", cpld_str, version); + snprintf(cpld_str, ONLP_CONFIG_INFO_STR_MAX, "%s ", version); rv = _sysi_version_parsing(INV_HWMON_PREFIX"version", "ver: ", version); if( rv != ONLP_STATUS_OK ) { return rv; } - snprintf(other_str, ONLP_CONFIG_INFO_STR_MAX, "%s%s.%s " - ,other_str, "psoc", version); + snprintf(other_str, ONLP_CONFIG_INFO_STR_MAX, "%s.%s " + , "psoc", version); /*cpld version*/ if(strlen(cpld_str) > 0) { diff --git a/packages/platforms/inventec/x86-64/d3352/onlp/builds/x86_64_inventec_d3352/module/src/sysi.c b/packages/platforms/inventec/x86-64/d3352/onlp/builds/x86_64_inventec_d3352/module/src/sysi.c index 64347cd9be..311f851d64 100644 --- a/packages/platforms/inventec/x86-64/d3352/onlp/builds/x86_64_inventec_d3352/module/src/sysi.c +++ b/packages/platforms/inventec/x86-64/d3352/onlp/builds/x86_64_inventec_d3352/module/src/sysi.c @@ -118,13 +118,13 @@ onlp_sysi_platform_info_get(onlp_platform_info_t* pi) if( rv != ONLP_STATUS_OK ) { return rv; } - snprintf(cpld_str, ONLP_CONFIG_INFO_STR_MAX, "%s%s ", cpld_str, version); + snprintf(cpld_str, ONLP_CONFIG_INFO_STR_MAX, "%s ", version); rv = _sysi_version_parsing(INV_PSOC_PREFIX"version", "ver: ", version); if( rv != ONLP_STATUS_OK ) { return rv; } - snprintf(other_str, ONLP_CONFIG_INFO_STR_MAX, "%s%s%s " - ,other_str, "\n\t\tpsoc: ", version); + snprintf(other_str, ONLP_CONFIG_INFO_STR_MAX, "%s%s " + , "\n\t\tpsoc: ", version); /*cpld version*/ if(strlen(cpld_str) > 0) { diff --git a/packages/platforms/inventec/x86-64/d5254/onlp/builds/x86_64_inventec_d5254/module/src/sysi.c b/packages/platforms/inventec/x86-64/d5254/onlp/builds/x86_64_inventec_d5254/module/src/sysi.c index 7e0ee398db..ca45f7b013 100644 --- a/packages/platforms/inventec/x86-64/d5254/onlp/builds/x86_64_inventec_d5254/module/src/sysi.c +++ b/packages/platforms/inventec/x86-64/d5254/onlp/builds/x86_64_inventec_d5254/module/src/sysi.c @@ -376,11 +376,11 @@ onlp_sysi_platform_info_get(onlp_platform_info_t* pi) rv = _sysi_version_parsing(INV_SYSLED_PREFIX"info", "The CPLD version is ", version); if( rv != ONLP_STATUS_OK ) { return rv; } - snprintf(cpld_str, ONLP_CONFIG_INFO_STR_MAX, "%s%s ", cpld_str, version); + snprintf(cpld_str, ONLP_CONFIG_INFO_STR_MAX, "%s ", version); rv = _sysi_version_parsing(INV_HWMON_PREFIX"version", "ver: ", version); if( rv != ONLP_STATUS_OK ) { return rv; } - snprintf(other_str, ONLP_CONFIG_INFO_STR_MAX, "%s%s.%s " - ,other_str, "psoc", version); + snprintf(other_str, ONLP_CONFIG_INFO_STR_MAX, "%s.%s " + , "psoc", version); /*cpld version*/ if(strlen(cpld_str) > 0) { diff --git a/packages/platforms/inventec/x86-64/d5264q28b/onlp/builds/x86_64_inventec_d5264q28b/module/src/sysi.c b/packages/platforms/inventec/x86-64/d5264q28b/onlp/builds/x86_64_inventec_d5264q28b/module/src/sysi.c index 42b80d264f..0755284ad4 100644 --- a/packages/platforms/inventec/x86-64/d5264q28b/onlp/builds/x86_64_inventec_d5264q28b/module/src/sysi.c +++ b/packages/platforms/inventec/x86-64/d5264q28b/onlp/builds/x86_64_inventec_d5264q28b/module/src/sysi.c @@ -158,11 +158,11 @@ onlp_sysi_platform_info_get(onlp_platform_info_t* pi) rv = _sysi_version_parsing(INV_SYSLED_PREFIX"info", "The CPLD version is ", version); if( rv != ONLP_STATUS_OK ) { return rv; } - snprintf(cpld_str, ONLP_CONFIG_INFO_STR_MAX, "%s%s ", cpld_str, version); + snprintf(cpld_str, ONLP_CONFIG_INFO_STR_MAX, "%s ", version); rv = _sysi_version_parsing(INV_HWMON_PREFIX"version", "ver: ", version); if( rv != ONLP_STATUS_OK ) { return rv; } - snprintf(other_str, ONLP_CONFIG_INFO_STR_MAX, "%s%s.%s " - ,other_str, "psoc", version); + snprintf(other_str, ONLP_CONFIG_INFO_STR_MAX, "%s.%s " + , "psoc", version); /*cpld version*/ if(strlen(cpld_str) > 0) { diff --git a/packages/platforms/inventec/x86-64/d6356/onlp/builds/x86_64_inventec_d6356/module/src/sysi.c b/packages/platforms/inventec/x86-64/d6356/onlp/builds/x86_64_inventec_d6356/module/src/sysi.c index 8ec104c1a0..5bc08d4304 100644 --- a/packages/platforms/inventec/x86-64/d6356/onlp/builds/x86_64_inventec_d6356/module/src/sysi.c +++ b/packages/platforms/inventec/x86-64/d6356/onlp/builds/x86_64_inventec_d6356/module/src/sysi.c @@ -81,7 +81,8 @@ static int _sysi_version_parsing(char* file_str, char* str_buf, char* str_buf2, } else { return ONLP_STATUS_E_INVALID; } - snprintf(version, ONLP_CONFIG_INFO_STR_MAX, "c1_%s c2_%s", cpld_v1, cpld_v2); + /* Limit input strings to prevent truncation: "c1_" (3) + cpld_v1 + " c2_" (4) + cpld_v2 + null (1) */ + snprintf(version, ONLP_CONFIG_INFO_STR_MAX, "c1_%.26s c2_%.26s", cpld_v1, cpld_v2); return rv; } @@ -190,7 +191,6 @@ int onlp_sysi_platform_info_get(onlp_platform_info_t* pi) { int rv = ONLP_STATUS_OK; - char cpld_str[ONLP_CONFIG_INFO_STR_MAX] = {0}; char version[ONLP_CONFIG_INFO_STR_MAX]; pi->cpld_versions = NULL; @@ -198,10 +198,9 @@ onlp_sysi_platform_info_get(onlp_platform_info_t* pi) if ( rv != ONLP_STATUS_OK ) { return rv; } - snprintf(cpld_str, ONLP_CONFIG_INFO_STR_MAX, "%s%s ", cpld_str, version); /*cpld version*/ - if (strlen(cpld_str) > 0) { - pi->cpld_versions = aim_fstrdup("%s", cpld_str); + if (strlen(version) > 0) { + pi->cpld_versions = aim_fstrdup("%s", version); } return rv; } diff --git a/packages/platforms/inventec/x86-64/d6432/onlp/builds/x86_64_inventec_d6432/module/src/sysi.c b/packages/platforms/inventec/x86-64/d6432/onlp/builds/x86_64_inventec_d6432/module/src/sysi.c index a130d13552..57f3fc4cf3 100644 --- a/packages/platforms/inventec/x86-64/d6432/onlp/builds/x86_64_inventec_d6432/module/src/sysi.c +++ b/packages/platforms/inventec/x86-64/d6432/onlp/builds/x86_64_inventec_d6432/module/src/sysi.c @@ -90,7 +90,8 @@ static int _sysi_version_parsing(char* file_str, char* str_buf, char* version) } else { return ONLP_STATUS_E_INVALID; } - snprintf(version, ONLP_CONFIG_INFO_STR_MAX, "c1_%s c2_%s", cpld_v1, cpld_v2); + /* Limit input strings to prevent truncation: "c1_" (3) + cpld_v1 + " c2_" (4) + cpld_v2 + null (1) */ + snprintf(version, ONLP_CONFIG_INFO_STR_MAX, "c1_%.26s c2_%.26s", cpld_v1, cpld_v2); return rv; } @@ -199,7 +200,6 @@ int onlp_sysi_platform_info_get(onlp_platform_info_t* pi) { int rv = ONLP_STATUS_OK; - char cpld_str[ONLP_CONFIG_INFO_STR_MAX] = {0}; char version[ONLP_CONFIG_INFO_STR_MAX]; pi->cpld_versions = NULL; @@ -207,10 +207,9 @@ onlp_sysi_platform_info_get(onlp_platform_info_t* pi) if ( rv != ONLP_STATUS_OK ) { return rv; } - snprintf(cpld_str, ONLP_CONFIG_INFO_STR_MAX, "%s%s ", cpld_str, version); /*cpld version*/ - if (strlen(cpld_str) > 0) { - pi->cpld_versions = aim_fstrdup("%s", cpld_str); + if (strlen(version) > 0) { + pi->cpld_versions = aim_fstrdup("%s", version); } return rv; } diff --git a/packages/platforms/inventec/x86-64/d7332/onlp/builds/x86_64_inventec_d7332/module/src/sysi.c b/packages/platforms/inventec/x86-64/d7332/onlp/builds/x86_64_inventec_d7332/module/src/sysi.c index 23d16d7bac..4c0de0b876 100644 --- a/packages/platforms/inventec/x86-64/d7332/onlp/builds/x86_64_inventec_d7332/module/src/sysi.c +++ b/packages/platforms/inventec/x86-64/d7332/onlp/builds/x86_64_inventec_d7332/module/src/sysi.c @@ -90,7 +90,8 @@ static int _sysi_version_parsing(char* file_str, char* str_buf, char* version) } else { return ONLP_STATUS_E_INVALID; } - snprintf(version, ONLP_CONFIG_INFO_STR_MAX, "c1_%s c2_%s", cpld_v1, cpld_v2); + /* Limit input strings to prevent truncation: "c1_" (3) + cpld_v1 + " c2_" (4) + cpld_v2 + null (1) */ + snprintf(version, ONLP_CONFIG_INFO_STR_MAX, "c1_%.26s c2_%.26s", cpld_v1, cpld_v2); return rv; } @@ -199,7 +200,6 @@ int onlp_sysi_platform_info_get(onlp_platform_info_t* pi) { int rv = ONLP_STATUS_OK; - char cpld_str[ONLP_CONFIG_INFO_STR_MAX] = {0}; char version[ONLP_CONFIG_INFO_STR_MAX]; pi->cpld_versions = NULL; @@ -207,10 +207,9 @@ onlp_sysi_platform_info_get(onlp_platform_info_t* pi) if ( rv != ONLP_STATUS_OK ) { return rv; } - snprintf(cpld_str, ONLP_CONFIG_INFO_STR_MAX, "%s%s ", cpld_str, version); /*cpld version*/ - if (strlen(cpld_str) > 0) { - pi->cpld_versions = aim_fstrdup("%s", cpld_str); + if (strlen(version) > 0) { + pi->cpld_versions = aim_fstrdup("%s", version); } return rv; } diff --git a/packages/platforms/netberg/x86-64/aurora-610/onlp/builds/x86_64_netberg_aurora_610/module/src/sysi.c b/packages/platforms/netberg/x86-64/aurora-610/onlp/builds/x86_64_netberg_aurora_610/module/src/sysi.c index 0d937a39cf..1ea4b51b85 100644 --- a/packages/platforms/netberg/x86-64/aurora-610/onlp/builds/x86_64_netberg_aurora_610/module/src/sysi.c +++ b/packages/platforms/netberg/x86-64/aurora-610/onlp/builds/x86_64_netberg_aurora_610/module/src/sysi.c @@ -331,13 +331,13 @@ onlp_sysi_platform_info_get(onlp_platform_info_t* pi) if( rv != ONLP_STATUS_OK ) { return rv; } - snprintf(cpld_str, ONLP_CONFIG_INFO_STR_MAX, "%s%s ", cpld_str, version); + snprintf(cpld_str, ONLP_CONFIG_INFO_STR_MAX, "%s ", version); rv = _sysi_version_parsing(NET_HWMON_PREFIX"version", "ver: ", version); if( rv != ONLP_STATUS_OK ) { return rv; } - snprintf(other_str, ONLP_CONFIG_INFO_STR_MAX, "%s%s.%s " - ,other_str, "psoc", version); + snprintf(other_str, ONLP_CONFIG_INFO_STR_MAX, "%s.%s " + , "psoc", version); /*cpld version*/ if(strlen(cpld_str) > 0) { diff --git a/packages/platforms/netberg/x86-64/aurora-820/onlp/builds/x86_64_netberg_aurora_820/module/src/sysi.c b/packages/platforms/netberg/x86-64/aurora-820/onlp/builds/x86_64_netberg_aurora_820/module/src/sysi.c index 2242cf1f6e..c427c8943f 100644 --- a/packages/platforms/netberg/x86-64/aurora-820/onlp/builds/x86_64_netberg_aurora_820/module/src/sysi.c +++ b/packages/platforms/netberg/x86-64/aurora-820/onlp/builds/x86_64_netberg_aurora_820/module/src/sysi.c @@ -87,7 +87,8 @@ static int _sysi_version_parsing(char* file_str, char* str_buf, char* version) } else { return ONLP_STATUS_E_INVALID; } - snprintf(version, ONLP_CONFIG_INFO_STR_MAX, "c1_%s c2_%s", cpld_v1, cpld_v2); + /* Limit input strings to prevent truncation: "c1_" (3) + cpld_v1 + " c2_" (4) + cpld_v2 + null (1) */ + snprintf(version, ONLP_CONFIG_INFO_STR_MAX, "c1_%.26s c2_%.26s", cpld_v1, cpld_v2); return rv; } @@ -196,7 +197,6 @@ int onlp_sysi_platform_info_get(onlp_platform_info_t* pi) { int rv = ONLP_STATUS_OK; - char cpld_str[ONLP_CONFIG_INFO_STR_MAX] = {0}; char version[ONLP_CONFIG_INFO_STR_MAX]; pi->cpld_versions = NULL; @@ -204,10 +204,9 @@ onlp_sysi_platform_info_get(onlp_platform_info_t* pi) if ( rv != ONLP_STATUS_OK ) { return rv; } - snprintf(cpld_str, ONLP_CONFIG_INFO_STR_MAX, "%s%s ", cpld_str, version); /*cpld version*/ - if (strlen(cpld_str) > 0) { - pi->cpld_versions = aim_fstrdup("%s", cpld_str); + if (strlen(version) > 0) { + pi->cpld_versions = aim_fstrdup("%s", version); } return rv; }