From 35432762a338dd934053fae84af84f4a92fe29b4 Mon Sep 17 00:00:00 2001 From: rdkdevpilot Date: Sun, 11 Oct 2026 01:39:02 +0530 Subject: [PATCH 1/7] Fix SIZEOF_MISMATCH in main.c Defect ID: 94bafbe6-bafc-4589-ad71-0dd4390aeb49 --- c_sourcecode/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c_sourcecode/src/main.c b/c_sourcecode/src/main.c index 6f82c749..9cdae659 100644 --- a/c_sourcecode/src/main.c +++ b/c_sourcecode/src/main.c @@ -245,7 +245,7 @@ int main_test(int argc, char *argv[]) goto cleanup; } - memset(archive, '\0', dump_count * sizeof(archive)); + memset(archive, '\0', dump_count * sizeof(*archive)); /* 5.2: Process each dump */ for (int i = 0; i < dump_count; i++) { From fe5e8986f4f907835846e35c67c4a9f670541a36 Mon Sep 17 00:00:00 2001 From: rdkdevpilot Date: Sun, 11 Oct 2026 01:39:03 +0530 Subject: [PATCH 2/7] Fix TAINTED_SCALAR in prerequisites.c Defect ID: ecbd428a-e53f-4374-aac8-291f83795f10 --- c_sourcecode/src/utils/prerequisites.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/c_sourcecode/src/utils/prerequisites.c b/c_sourcecode/src/utils/prerequisites.c index 910f3f65..96efa32f 100644 --- a/c_sourcecode/src/utils/prerequisites.c +++ b/c_sourcecode/src/utils/prerequisites.c @@ -63,11 +63,11 @@ void defer_upload_if_needed(device_type_t device_type) int uptime_val = (int)uptime_seconds; - if (uptime_val < FOUR_EIGHTY_SECS) + if (uptime_val < FOUR_EIGHTY_SECS && uptime_val >= 0) { - + int sleep_time = FOUR_EIGHTY_SECS - uptime_val; - + CRASHUPLOAD_INFO("Deferring Upload for %d seconds\n", sleep_time); sleep(sleep_time); CRASHUPLOAD_INFO("Deferring Upload for %d seconds completed\n", sleep_time); From 4f92ec3278b45b63ea6892cb7ae5a544e90eb86c Mon Sep 17 00:00:00 2001 From: rdkdevpilot Date: Sun, 11 Oct 2026 01:39:05 +0530 Subject: [PATCH 3/7] Fix OVERRUN in ratelimit.c Defect ID: d3d36774-e66d-4270-a20f-ea0b73848ca7 --- c_sourcecode/src/ratelimit/ratelimit.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/c_sourcecode/src/ratelimit/ratelimit.c b/c_sourcecode/src/ratelimit/ratelimit.c index e16a9e95..884b4c65 100644 --- a/c_sourcecode/src/ratelimit/ratelimit.c +++ b/c_sourcecode/src/ratelimit/ratelimit.c @@ -121,7 +121,7 @@ int is_upload_limit_reached(const char *file) } /* Validate numeric content of FIRST line */ - for (size_t i = 0; first_line_data[i] != '\0' && first_line_data[i] != '\n' && i < sizeof(first_line_data); i++) + for (size_t i = 0; i < sizeof(first_line_data) && first_line_data[i] != '\0' && first_line_data[i] != '\n'; i++) { if (!isdigit((unsigned char)first_line_data[i])) { @@ -171,7 +171,6 @@ int is_upload_limit_reached(const char *file) int is_recovery_time_reached(const char *deny_file) { - struct stat st; FILE *fp; char buf[32]; char *endptr; @@ -181,10 +180,7 @@ int is_recovery_time_reached(const char *deny_file) if (!deny_file) return ALLOW_UPLOAD; /* allow upload */ - /* If deny file does not exist, allow */ - if (stat(deny_file, &st) != 0) - return ALLOW_UPLOAD; - + /* Open directly; let fopen() report absence atomically */ fp = fopen(deny_file, "r"); if (!fp) return ALLOW_UPLOAD; @@ -197,7 +193,7 @@ int is_recovery_time_reached(const char *deny_file) fclose(fp); /* Validate numeric content with bounds check */ - for (size_t i = 0; buf[i] != '\0' && buf[i] != '\n' && i < sizeof(buf); i++) + for (size_t i = 0; i < sizeof(buf) && buf[i] != '\0' && buf[i] != '\n'; i++) { if (!isdigit((unsigned char)buf[i])) return ALLOW_UPLOAD; From fe3ec45f534a3d51f3aedfcdab58da338011567d Mon Sep 17 00:00:00 2001 From: rdkdevpilot Date: Sun, 11 Oct 2026 01:39:07 +0530 Subject: [PATCH 4/7] Fix OVERRUN in scanner.c Defect ID: 9e9a9a4c-44db-4277-b0ad-77be6d088e1b --- c_sourcecode/src/scanner/scanner.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/c_sourcecode/src/scanner/scanner.c b/c_sourcecode/src/scanner/scanner.c index 81d6c809..20bf8041 100644 --- a/c_sourcecode/src/scanner/scanner.c +++ b/c_sourcecode/src/scanner/scanner.c @@ -605,8 +605,8 @@ int processCrashTelemetryInfo(const char *rawfile, const char *log_path, bool t2 snprintf(Appname, sizeof(Appname), "%s", us + 1); size_t pnamelen = (size_t)(us - containerName); - if (pnamelen >= sizeof(ProcessName)) - pnamelen = sizeof(ProcessName) - 1; + if (pnamelen >= sizeof(containerName)) + pnamelen = sizeof(containerName) - 1; memcpy(ProcessName, containerName, pnamelen); ProcessName[pnamelen] = '\0'; } From 02201a263d93a95f62a17d6116f18177ec521777 Mon Sep 17 00:00:00 2001 From: rdkdevpilot Date: Sun, 11 Oct 2026 01:39:09 +0530 Subject: [PATCH 5/7] Fix BUFFER_SIZE in archive.c Defect ID: 02eb5c8a-2c6e-4b46-a6d5-480416ac5b1c --- c_sourcecode/src/archive/archive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c_sourcecode/src/archive/archive.c b/c_sourcecode/src/archive/archive.c index 69185000..be009647 100644 --- a/c_sourcecode/src/archive/archive.c +++ b/c_sourcecode/src/archive/archive.c @@ -262,7 +262,7 @@ int archive_create_smart(const dump_file_t *dump, const config_t *config, while ((tmp = strstr(new_dump_name, pattern)) != NULL) { *tmp = '_'; - strcpy(tmp + 1, tmp + pattern_len); + memmove(tmp + 1, tmp + pattern_len, strlen(tmp + pattern_len) + 1); } CRASHUPLOAD_INFO("archive_create_smart() After process dump name=%s\n", new_dump_name); From ec5d9e21e66e1eb7adaff4fd13b0199b216bed49 Mon Sep 17 00:00:00 2001 From: rdkdevpilot Date: Sun, 11 Oct 2026 01:39:11 +0530 Subject: [PATCH 6/7] Fix UNUSED_VALUE in platform.c Defect ID: 1dd4d01a-823e-468e-a5e9-72e72f662f9f --- c_sourcecode/src/platform/platform.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/c_sourcecode/src/platform/platform.c b/c_sourcecode/src/platform/platform.c index c13df3f7..9154908d 100644 --- a/c_sourcecode/src/platform/platform.c +++ b/c_sourcecode/src/platform/platform.c @@ -90,8 +90,7 @@ size_t GetEstbMac(char *pEstbMac, size_t szBufSize) { if (NULL != (fgets(pEstbMac, szBufSize, fp))) { // better be a valid string on first line - i = stripinvalidchar(pEstbMac, szBufSize); - } + } fclose(fp); i = stripinvalidchar(pEstbMac, szBufSize); CRASHUPLOAD_INFO("GetEstbMac: After reading %s value=%s\n", MAC_FILE, pEstbMac); From a11418a670ba3596577095b3e89b9d3742d66ac1 Mon Sep 17 00:00:00 2001 From: rdkdevpilot Date: Sun, 11 Oct 2026 01:39:13 +0530 Subject: [PATCH 7/7] Fix RW.EXP_SEMICOLON in cleanup_batch.c Defect ID: a70f1faf-76f9-41cf-a59a-3d43dcc667a1 --- c_sourcecode/src/utils/cleanup_batch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c_sourcecode/src/utils/cleanup_batch.c b/c_sourcecode/src/utils/cleanup_batch.c index 2b1339ae..325e1ce0 100644 --- a/c_sourcecode/src/utils/cleanup_batch.c +++ b/c_sourcecode/src/utils/cleanup_batch.c @@ -528,7 +528,7 @@ void remove_pending_dumps(const char *working_dir, snprintf(path, sizeof(path), "%s/%s", working_dir, entry->d_name); - if (stat(path, &st) < 0) + if (lstat(path, &st) < 0) { CRASHUPLOAD_WARN("stat Error: %s\n", path); continue;