Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
cd795e2
Refactor issueTypeSplitter to include suffix handling
Abhinavpv28 Apr 30, 2026
a950f13
Update rrdEventProcess.c
Abhinavpv28 Apr 30, 2026
ba3c8ca
Update rrdExecuteScript.c
Abhinavpv28 Apr 30, 2026
63bc161
Refactor rrdEventProcess.h to rrdExecuteScript.h
Abhinavpv28 Apr 30, 2026
c883bd2
Update rrdExecuteScript.h
Abhinavpv28 Apr 30, 2026
9380442
Update rrdExecuteScript.h
Abhinavpv28 Apr 30, 2026
61a9e2c
Update rrdEventProcess.h
Abhinavpv28 Apr 30, 2026
d672210
Update rrdExecuteScript.h
Abhinavpv28 Apr 30, 2026
65d30d0
Update rrdJsonParser.c
Abhinavpv28 Apr 30, 2026
93df789
Update rrdJsonParser.h
Abhinavpv28 Apr 30, 2026
6d37d71
Update rrdInterface.c
Abhinavpv28 Apr 30, 2026
c7588d3
Update rrdCommon.h
Abhinavpv28 Apr 30, 2026
d1345ab
Update rrdEventProcess.c
Abhinavpv28 Apr 30, 2026
e720479
Update rrdEventProcess.c
Abhinavpv28 May 1, 2026
faacd2a
Update rrdEventProcess.c
Abhinavpv28 May 1, 2026
7daeac3
Update rrdEventProcess.c
Abhinavpv28 May 1, 2026
52539a3
Fix indentation for appendMode assignment
Abhinavpv28 May 1, 2026
ec1680e
Update rrdCommon.h
Abhinavpv28 May 1, 2026
bfb7f1e
Fix appendMode assignment in rrdEventProcess.c
Abhinavpv28 May 1, 2026
e71f82e
Update rrdEventProcess.c
Abhinavpv28 May 1, 2026
72b9562
Update rrdJsonParser.c
Abhinavpv28 May 1, 2026
e6b8690
Update rrdEventProcess.c
Abhinavpv28 May 1, 2026
79f6e64
Update rrdExecuteScript.h
Abhinavpv28 May 1, 2026
bd49f43
Update rrdExecuteScript.c
Abhinavpv28 May 1, 2026
3a5f988
Update rrdExecuteScript.c
Abhinavpv28 May 1, 2026
4587984
Update rrdExecuteScript.c
Abhinavpv28 May 1, 2026
5c3f460
Remove redundant logging from rrdJsonParser
Abhinavpv28 May 1, 2026
3d77c29
Update rrdJsonParser.c
Abhinavpv28 May 1, 2026
b5f062b
Update rrdEventProcess.c
Abhinavpv28 May 1, 2026
f21ad0f
Update rrdJsonParser.c
Abhinavpv28 May 1, 2026
02a0507
Update rrdEventProcess.c
Abhinavpv28 May 1, 2026
f509d0a
Update rrdJsonParser.c
Abhinavpv28 May 1, 2026
d10faa4
Apply suggestions from code review
Abhinavpv28 May 1, 2026
5835261
Update rrdEventProcess.c
Abhinavpv28 May 1, 2026
c9dfede
Apply suggestion from @Copilot
Abhinavpv28 May 1, 2026
3c19ac2
Update rrdJsonParser.c
Abhinavpv28 May 1, 2026
3084d70
Fix heap overflow in issueTypeSplitter and memory leaks in suffix han…
Copilot May 2, 2026
eca3fb2
Update rrdUnitTestRunner.cpp
Abhinavpv28 May 2, 2026
2cca47b
Delete .gitignore
Abhinavpv28 May 2, 2026
f44f131
Potential fix for pull request finding
Abhinavpv28 May 2, 2026
9a6cf0d
Update rrdEventProcess.c
Abhinavpv28 May 2, 2026
ae506f9
Update rrdEventProcess.c
Abhinavpv28 May 2, 2026
2e8a039
Update rrdEventProcess.c
Abhinavpv28 May 2, 2026
36587ee
Update rrdEventProcess.c
Abhinavpv28 May 2, 2026
acacbdb
Update rrdUnitTestRunner.cpp
Abhinavpv28 May 2, 2026
5fb10ce
Update rrdEventProcess.c
Abhinavpv28 May 3, 2026
6e21ca0
Update rrdUnitTestRunner.cpp
Abhinavpv28 May 3, 2026
8105959
Update rrdUnitTestRunner.cpp
Abhinavpv28 May 3, 2026
a87a726
Add gtest test cases for split_issue_type
Copilot May 3, 2026
617edf9
Remove build artifacts, add .gitignore
Copilot May 3, 2026
05e0cf8
Add explicit truncated content assertion in SuffixTruncatedWhenTooSma…
Copilot May 3, 2026
3a0687a
Apply suggestions from code review
Abhinavpv28 May 3, 2026
842577e
Update rrdEventProcess.c
Abhinavpv28 May 3, 2026
3b6ffba
Update rrdEventProcess.c
Abhinavpv28 May 3, 2026
638a63e
Update rrdEventProcess.c
Abhinavpv28 May 3, 2026
a889589
Update rrdEventProcess.c
Abhinavpv28 May 3, 2026
f78c999
Update rrdEventProcess.c
Abhinavpv28 May 3, 2026
8405fb2
Update rrdEventProcess.c
Abhinavpv28 May 3, 2026
0038f01
Update rrdEventProcess.c
Abhinavpv28 May 3, 2026
b445c8a
Update rrdEventProcess.c
Abhinavpv28 May 3, 2026
64dc355
Update rrdEventProcess.c
Abhinavpv28 May 3, 2026
0d9850a
Update rrdEventProcess.c
Abhinavpv28 May 3, 2026
ca8c14c
Update rrdEventProcess.c
Abhinavpv28 May 3, 2026
4cb74db
Update rrdEventProcess.c
Abhinavpv28 May 3, 2026
5bf24f2
Potential fix for pull request finding
Abhinavpv28 May 3, 2026
a44c0e8
Update rrdJsonParser.c
Abhinavpv28 May 3, 2026
3a798ef
Update rrdJsonParser.c
Abhinavpv28 May 3, 2026
c350bb0
Potential fix for pull request finding
Abhinavpv28 May 3, 2026
cf3a830
Potential fix for pull request finding
Abhinavpv28 May 3, 2026
1bc5ed3
Potential fix for pull request finding
Abhinavpv28 May 3, 2026
7d1e5ad
Update rrdUnitTestRunner.cpp
Abhinavpv28 May 3, 2026
f8519e1
Potential fix for pull request finding
Abhinavpv28 May 4, 2026
45e7d46
Potential fix for pull request finding
Abhinavpv28 May 4, 2026
9f2018d
Delete .gitignore
Abhinavpv28 May 4, 2026
94e5848
Delete src/unittest/UTJson/device.properties
Abhinavpv28 May 4, 2026
6aaa224
Update rrdEventProcess.c
Abhinavpv28 May 4, 2026
dcff40f
Add gtest tests for split_issue_type, suffix field, and processIssueT…
Copilot May 4, 2026
22f93ba
Delete .gitignore
Abhinavpv28 May 5, 2026
881aa5f
Validate suffix prefix: only _Search- and _LogSearch- are allowed
Copilot May 5, 2026
d031661
Base never contains underscore: split at first _ and discard invalid …
Copilot May 5, 2026
9a6b977
Update rrdEventProcess.c
Abhinavpv28 May 5, 2026
815b247
Update rrdUnitTestRunner.cpp
Abhinavpv28 May 5, 2026
43a64e1
Update rrdEventProcess.c
Abhinavpv28 May 5, 2026
31494a7
Update rrdEventProcess.c
Abhinavpv28 May 5, 2026
17289c1
Fix segfault in GTEST_ENABLE mode when rbuf->jsonPath is NULL
Copilot May 5, 2026
5c8ffb8
Remove accidentally committed dummy directory and update .gitignore
Copilot May 5, 2026
2d65f7e
Fix IssueTypeSplitterTest to match new issueTypeSplitter behavior (no…
Copilot May 6, 2026
f64d401
Fix empty/whitespace IssueType bypassing processIssueTypeEvent guards
Copilot May 6, 2026
1635836
fix: preserve hyphens in archive filename so portal can parse it corr…
Copilot May 6, 2026
9bf94a5
fix: replace _Search-/_LogSearch- prefix check with suffix length <= …
Copilot May 6, 2026
cbf80c0
refactor: improve RRD_MAX_SUFFIX_LEN comment and rename length-based …
Copilot May 6, 2026
6a26473
feat: move suffix to after timestamp in archive filename
Copilot May 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Autotools build artifacts
Makefile.in
aclocal.m4
autom4te.cache/
compile
config.guess
config.h.in
config.log
config.sub
configure
depcomp
install-sh
ltmain.sh
m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
missing
config.status
Makefile
src/Makefile
src/unittest/Makefile

# Build output files
*.o
*.a
*.so
*.lo
*.la
*.Po
*.Plo
*.gcda
*.gcno
*.gcov
.deps/
.libs/

# Test binaries and coverage output
src/unittest/remotedebugger_gtest
src/unittest/COPYING
src/unittest/INSTALL
src/unittest/dummy_*/

# Generated test data files
src/unittest/UTJson/device.properties
dummy_*/
1 change: 1 addition & 0 deletions src/rrdCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ typedef struct mbuffer {
bool inDynamic;
bool appendMode;
deepsleep_event_et dsEvent;
char *suffix; // Holds the suffix split from issue type string, if any
} data_buf;

/*Structure for Message Header*/
Expand Down
61 changes: 56 additions & 5 deletions src/rrdEventProcess.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,35 @@ void processIssueTypeEvent(data_buf *rbuf)
cmdBuff = (data_buf *)malloc(sizeof(data_buf));
if (cmdBuff)
{
dataMsgLen = strlen(cmdMap[index]) + 1;
char base[128] = {0};
char local_suffix[128] = {0};
split_issue_type(cmdMap[index], base, sizeof(base), local_suffix, sizeof(local_suffix));
if (base[0] == '\0')
{
RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "[%s:%d]: Empty issue type after parsing token [%s], skipping... \n", __FUNCTION__, __LINE__, cmdMap[index]);
free(cmdBuff);
cmdBuff = NULL;
if (cmdMap[index])
{
free(cmdMap[index]);
cmdMap[index] = NULL;
}
continue;
}
removeSpecialCharacterfromIssueTypeList(base);
if (base[0] == '\0')
{
RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "[%s:%d]: Empty base after sanitization for token [%s], skipping... \n", __FUNCTION__, __LINE__, cmdMap[index]);
free(cmdBuff);
cmdBuff = NULL;
if (cmdMap[index])
{
free(cmdMap[index]);
cmdMap[index] = NULL;
}
continue;
}
dataMsgLen = strlen(base) + 1;
RRD_data_buff_init(cmdBuff, EVENT_MSG, RRD_DEEPSLEEP_INVALID_DEFAULT); /* Setting Deafult Values*/
cmdBuff->inDynamic = rbuf->inDynamic;
if(cmdBuff->inDynamic)
Expand All @@ -88,9 +116,19 @@ void processIssueTypeEvent(data_buf *rbuf)
}
cmdBuff->appendMode = rbuf->appendMode;
Comment thread
Abhinavpv28 marked this conversation as resolved.
Comment on lines 111 to 117
cmdBuff->mdata = (char *)calloc(1, dataMsgLen);

/* Store suffix for this issue type */
cmdBuff->suffix = NULL;
if (local_suffix[0] != '\0') {
cmdBuff->suffix = strdup(local_suffix);
if (cmdBuff->suffix == NULL)
{
RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "[%s:%d]: Failed to allocate memory for suffix... \n", __FUNCTION__, __LINE__);
}
}
if (cmdBuff->mdata)
{
strncpy((char *)cmdBuff->mdata, cmdMap[index], dataMsgLen);
strncpy((char *)cmdBuff->mdata, base, dataMsgLen);
processIssueType(cmdBuff);
}
else
Expand All @@ -99,6 +137,11 @@ void processIssueTypeEvent(data_buf *rbuf)
}
if(cmdBuff)
{
if (cmdBuff->suffix)
{
free(cmdBuff->suffix);
cmdBuff->suffix = NULL;
}
free(cmdBuff);
cmdBuff = NULL;
}
Expand Down Expand Up @@ -392,7 +435,10 @@ static void processIssueTypeInStaticProfile(data_buf *rbuf, issueNodeData *pIssu
#if !defined(GTEST_ENABLE)
jsonParsed = readAndParseJSON(RRD_JSON_FILE);
#else
jsonParsed = readAndParseJSON(rbuf->jsonPath);
if (rbuf->jsonPath != NULL)
{
jsonParsed = readAndParseJSON(rbuf->jsonPath);
}
#endif
if (jsonParsed == NULL)
{ // Static Profile JSON Parsing or Read Fail
Expand Down Expand Up @@ -555,6 +601,11 @@ static void processIssueTypeInInstalledPackage(data_buf *rbuf, issueNodeData *pI
suffixlen = strlen(RDM_PKG_SUFFIX);
dynJSONPath = (char *)malloc(persistentAppslen + prefixlen + suffixlen + strlen(pIssueNode->Node) + rrdjsonlen + 1);
#else
if (rbuf->jsonPath == NULL)
{
RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: jsonPath is NULL in GTEST mode, skipping installed package check... \n", __FUNCTION__, __LINE__);
return;
}
int utjsonlen = strlen(rbuf->jsonPath);
dynJSONPath = (char *)malloc(utjsonlen + 1);
#endif
Expand Down Expand Up @@ -639,7 +690,8 @@ static void removeSpecialCharacterfromIssueTypeList(char *str)

while (str[source] != '\0')
{
if (isalnum(str[source]) || str[source] == ',' || str[source] == '.')
//if (isalnum(str[source]) || str[source] == ',' || str[source] == '.' || str[source] == '_'|| str[source] == '-')
if (isalnum(str[source]) || str[source] == ',' || str[source] == '.')
Comment on lines 690 to +694
{
Comment thread
Abhinavpv28 marked this conversation as resolved.
Comment on lines 691 to 695
str[destination] = str[source];
++destination;
Expand All @@ -663,7 +715,6 @@ static int issueTypeSplitter(char *input_str, const char delimeter, char ***args
int cnt = 1, i = 0;
char *str = input_str;

removeSpecialCharacterfromIssueTypeList(str);
while (*str == delimeter)
str++;

Expand Down
27 changes: 20 additions & 7 deletions src/rrdExecuteScript.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static void normalizeIssueName(char *str);
* @param char *issuename - Issue type from RFC.
* @return int - Returns 0 for success and non-zero for failure.
*/
int uploadDebugoutput(char *outdir, char *issuename)
int uploadDebugoutput(char *outdir, char *issuename, const char *suffix)
{
int ret = 0;

Expand All @@ -42,7 +42,7 @@ int uploadDebugoutput(char *outdir, char *issuename)
#ifdef IARMBUS_SUPPORT
RDK_LOG(RDK_LOG_INFO,LOG_REMDEBUG,"[%s:%d]: Starting Upload Debug output via API... \n",__FUNCTION__,__LINE__);

ret = rrd_upload_orchestrate(outdir, issuename);
ret = rrd_upload_orchestrate(outdir, issuename, suffix);
if(ret != 0)
{
RDK_LOG(RDK_LOG_ERROR,LOG_REMDEBUG,"[%s:%d]: Upload orchestration failed with code: %d\n",__FUNCTION__,__LINE__, ret);
Expand All @@ -52,11 +52,24 @@ int uploadDebugoutput(char *outdir, char *issuename)
RDK_LOG(RDK_LOG_INFO,LOG_REMDEBUG,"[%s:%d]: Upload orchestration completed successfully\n",__FUNCTION__,__LINE__);
}
#else
RDK_LOG(RDK_LOG_INFO,LOG_REMDEBUG,"[%s:%d]: Starting Upload Debug output Script: %s... \n",__FUNCTION__,__LINE__,RRD_SCRIPT);
if(v_secure_system("%s %s %s",RRD_SCRIPT,outdir,issuename) != 0)
{
ret = 1;
}
/* Shell-script path: suffix is appended to issuename so the script
* retains the old combined-name behaviour.
* Buffer: issuename is at most ~64 chars, suffix is at most 9 chars
* (RRD_MAX_SUFFIX_LEN), so 256 bytes gives ample headroom. */
if (suffix && suffix[0] != '\0') {
char issue_with_suffix[256];
int n = snprintf(issue_with_suffix, sizeof(issue_with_suffix), "%s%s", issuename, suffix);
if (n < 0 || (size_t)n >= sizeof(issue_with_suffix)) {
ret = 1;
} else if (v_secure_system("%s %s %s", RRD_SCRIPT, outdir, issue_with_suffix) != 0) {
ret = 1;
}
} else {
if(v_secure_system("%s %s %s",RRD_SCRIPT,outdir,issuename) != 0)
{
ret = 1;
}
}
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion src/rrdExecuteScript.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ extern "C"
#include "rrdCommon.h"
#include "rrd_upload.h"

int uploadDebugoutput(char *outdir, char *issuename);
int uploadDebugoutput(char *outdir, char *issuename, const char *suffix);

#ifdef __cplusplus
}
Expand Down
5 changes: 5 additions & 0 deletions src/rrdInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ void RRD_data_buff_init(data_buf *sbuf, message_type_et sndtype, deepsleep_event
sbuf->inDynamic = false;
sbuf->appendMode = false;
sbuf->dsEvent = deepSleepEvent;
sbuf->suffix = NULL;
}

/*Function: RRD_data_buff_deAlloc
Expand All @@ -295,6 +296,10 @@ void RRD_data_buff_deAlloc(data_buf *sbuf)
{
free(sbuf->jsonPath);
}
if (sbuf->suffix)
{
free(sbuf->suffix);
}
Comment thread
Abhinavpv28 marked this conversation as resolved.
free(sbuf);
}
}
Expand Down
Loading