Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
139 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
ae5391c
Update rrdJsonParser.c
Abhinavpv28 May 7, 2026
988005e
Update uploadRRDLogs.c
Abhinavpv28 May 8, 2026
8e172a3
Update uploadRRDLogs.c
Abhinavpv28 May 8, 2026
14f270e
Update rrdJsonParser.c
Abhinavpv28 May 8, 2026
331ae33
Delete .gitignore
Abhinavpv28 May 8, 2026
fcaf55d
Potential fix for pull request finding
Abhinavpv28 May 8, 2026
f9f5bcb
Update rrdEventProcess.c
Abhinavpv28 May 8, 2026
5695f28
Potential fix for pull request finding
Abhinavpv28 May 8, 2026
bc48c07
Update rrdJsonParser.c
Abhinavpv28 May 8, 2026
8f0c26e
Update rrdEventProcess.c
Abhinavpv28 May 8, 2026
7ae2461
sanitize split_issue_type suffix to [A-Za-z0-9_-] to prevent injection
Copilot May 8, 2026
74828d3
Update rrdEventProcess.c
Abhinavpv28 May 8, 2026
b63072b
Fix suffix propagation for dynamic RDM download cache flow
Copilot May 8, 2026
0018ede
Remove unintended autotools artifact symlinks
Copilot May 8, 2026
59ba72d
Preserve suffix in dynamic RDM cache and add append-mode test
Copilot May 8, 2026
ad21ae4
Address validation feedback on cache string handling
Copilot May 8, 2026
1ac8de2
Handle cache package strdup failure safely
Copilot May 8, 2026
ac73d60
Use snprintf result for cache string length logs
Copilot May 8, 2026
4c6c3c9
Update rrdCommon.h
Abhinavpv28 May 8, 2026
94fdcc0
Update rrdRunCmdThread.h
Abhinavpv28 May 8, 2026
7978fd8
Update rrdRunCmdThread.c
Abhinavpv28 May 8, 2026
14012d0
Update rrdInterface.c
Abhinavpv28 May 8, 2026
e0b4fdd
Update rrdIarmEvents.c
Abhinavpv28 May 8, 2026
00c4066
Update rrdDynamic.c
Abhinavpv28 May 8, 2026
98342d0
Update rrdRunCmdThread.h
Abhinavpv28 May 8, 2026
c95e7a7
Update rrdRunCmdThread.h
Abhinavpv28 May 8, 2026
5094044
Update rrdInterface.c
Abhinavpv28 May 8, 2026
842dbbb
Append restored cache suffix into issue type for download-complete ha…
Copilot May 8, 2026
f1278bb
Refine suffix append buffer sizing in download handlers
Copilot May 8, 2026
3d1815e
Update rrdIarmEvents.c
Abhinavpv28 May 8, 2026
7c22d5d
Simplify suffix handling in rrdInterface.c
Abhinavpv28 May 8, 2026
266d177
Update rrdInterface.c
Abhinavpv28 May 8, 2026
74df6dd
Update rrdIarmEvents.c
Abhinavpv28 May 8, 2026
8828149
Update rrdInterface.c
Abhinavpv28 May 8, 2026
5b73fb3
Update gtest cases for createCache/append_item suffix API
Copilot May 8, 2026
cac2a8d
Harden RRDRdmManagerDownloadRequestTest cache teardown locking
Copilot May 8, 2026
c46eeef
Update rrdEventProcess.c
Abhinavpv28 May 8, 2026
73e98e9
Update rrdEventProcess.c
Abhinavpv28 May 8, 2026
e4c17ab
Update rrdJsonParser.c
Abhinavpv28 May 8, 2026
5ad62fd
Update rrdJsonParser.c
Abhinavpv28 May 8, 2026
56a0a2e
Update rrdJsonParser.c
Abhinavpv28 May 9, 2026
4334155
Update rrdJsonParser.c
Abhinavpv28 May 9, 2026
31276b1
Update rrdJsonParser.c
Abhinavpv28 May 9, 2026
2239c9d
Update rrdJsonParser.c
Abhinavpv28 May 9, 2026
e69f637
Update rrdJsonParser.c
Abhinavpv28 May 9, 2026
2d5c26e
Update rrdJsonParser.c
Abhinavpv28 May 9, 2026
ff235ea
Update rrdJsonParser.c
Abhinavpv28 May 9, 2026
8b83b89
Update rrdEventProcess.c
Abhinavpv28 May 9, 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
43 changes: 43 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Build artifacts
*.o
*.lo
*.la
*.a
*.so
*.so.*
*.gcda
*.gcno
*.Po
remotedebugger
remotedebugger_gtest

# Autotools generated files
Makefile
Makefile.in
aclocal.m4
autom4te.cache/
compile
config.guess
config.h
config.h.in
config.log
config.status
config.sub
configure
configure~
configure.ac~
depcomp
install-sh
libtool
ltmain.sh
m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
missing
stamp-h1
.deps/

# Test runtime artifacts
src/unittest/dummy_*/
2 changes: 2 additions & 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 Expand Up @@ -124,6 +125,7 @@ typedef struct cache {
char *issueString;
struct cache *next;
struct cache *prev;
char *suffix; // Persist the suffix for later use
} cacheData;

/*Structure for Device Propertiesr*/
Expand Down
4 changes: 2 additions & 2 deletions src/rrdDynamic.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,12 @@ void RRDRdmManagerDownloadRequest(issueNodeData *pissueStructNode, char *dynJSON
strcpy(appendData,rbuf->mdata);
strcat(appendData,APPEND_SUFFIX);
RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: Cache String updated in appendmode IssueStr:%s Length:%d\n", __FUNCTION__, __LINE__, appendData, strlen(appendData));
append_item(strdup(msgDataString), strdup(appendData));
append_item(strdup(msgDataString), strdup(appendData), rbuf->suffix);
RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: Setting Parameters Success and Cache Updated ...%s IssueStr:%s Length:%d\n", __FUNCTION__, __LINE__, msgDataString, appendData, strlen(appendData));
}
else
{
append_item(strdup(msgDataString), strdup((char *)rbuf->mdata));
append_item(strdup(msgDataString), strdup((char *)rbuf->mdata), rbuf->suffix);
RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: Setting Parameters Success and Cache Updated ...%s IssueStr:%s Length:%d\n", __FUNCTION__, __LINE__, msgDataString, (char *)rbuf->mdata, strlen((char *)rbuf->mdata));
}
}
Expand Down
94 changes: 88 additions & 6 deletions src/rrdEventProcess.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,38 @@ 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);
Comment on lines +82 to +88
cmdBuff = NULL;
if (cmdMap[index])
{
free(cmdMap[index]);
cmdMap[index] = NULL;
}
continue;
}
if (strstr(base, APPEND_SUFFIX) == NULL)
{
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 +119,19 @@ void processIssueTypeEvent(data_buf *rbuf)
}
Comment on lines 114 to 119
Comment on lines 114 to 119
cmdBuff->appendMode = rbuf->appendMode;
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__);
Comment on lines 121 to +129
}
}
if (cmdBuff->mdata)
{
strncpy((char *)cmdBuff->mdata, cmdMap[index], dataMsgLen);
strncpy((char *)cmdBuff->mdata, base, dataMsgLen);
processIssueType(cmdBuff);
}
else
Expand All @@ -99,6 +140,11 @@ void processIssueTypeEvent(data_buf *rbuf)
}
if(cmdBuff)
{
if (cmdBuff->suffix)
{
free(cmdBuff->suffix);
cmdBuff->suffix = NULL;
}
Comment on lines +143 to +147
free(cmdBuff);
cmdBuff = NULL;
}
Expand Down Expand Up @@ -476,7 +522,14 @@ issueData* processIssueTypeInDynamicProfileappend(data_buf *rbuf, issueNodeData
free(dynJSONPath);
// Get the command for received Issue Type of the Issue Category
dynamicdata = getIssueCommandInfo(pIssueNode, jsonParsed, rbuf->mdata);
RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "[%s:%d]: Dynamic Profile Data: RFCValue: %s, Command: %s, Timeout: %d... \n", __FUNCTION__, __LINE__, dynamicdata->rfcvalue, dynamicdata->command, dynamicdata->timeout);
if (dynamicdata != NULL)
{
RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "[%s:%d]: Dynamic Profile Data: RFCValue: %s, Command: %s, Timeout: %d... \n", __FUNCTION__, __LINE__, dynamicdata->rfcvalue, dynamicdata->command, dynamicdata->timeout);
}
else
{
RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "[%s:%d]: Dynamic Profile command info is empty/invalid for issue %s, skip append path... \n", __FUNCTION__, __LINE__, rbuf->mdata);
}
}
else
{
Expand Down Expand Up @@ -514,7 +567,14 @@ issueData* processIssueTypeInStaticProfileappend(data_buf *rbuf, issueNodeData *
RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "[%s:%d]: Issue Data Node: %s and Sub-Node: %s found in Static JSON File %s... \n", __FUNCTION__, __LINE__, pIssueNode->Node, pIssueNode->subNode, RRD_JSON_FILE);
// Get the command for received Issue Type of the Issue Category
staticdata = getIssueCommandInfo(pIssueNode, jsonParsed, rbuf->mdata);
RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "[%s:%d]: Static Profile Data: RFCValue: %s, Command: %s, Timeout: %d... \n", __FUNCTION__, __LINE__, staticdata->rfcvalue, staticdata->command, staticdata->timeout);
if (staticdata != NULL)
{
RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "[%s:%d]: Static Profile Data: RFCValue: %s, Command: %s, Timeout: %d... \n", __FUNCTION__, __LINE__, staticdata->rfcvalue, staticdata->command, staticdata->timeout);
}
else
{
RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "[%s:%d]: Static Profile command info is empty/invalid for issue %s... \n", __FUNCTION__, __LINE__, rbuf->mdata);
}
}
else
{
Expand Down Expand Up @@ -555,6 +615,29 @@ 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 == NULL) || (rbuf->jsonPath == NULL))
{
RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: jsonPath is NULL, skipping installed package check... \n", __FUNCTION__, __LINE__);
if (rbuf != NULL)
{
if (rbuf->mdata != NULL)
{
free(rbuf->mdata);
rbuf->mdata = NULL;
}
if (rbuf->suffix != NULL)
{
free(rbuf->suffix);
rbuf->suffix = NULL;
}
if (rbuf->jsonPath != NULL)
{
free(rbuf->jsonPath);
rbuf->jsonPath = NULL;
}
}
return;
}
Comment on lines +618 to +640
int utjsonlen = strlen(rbuf->jsonPath);
dynJSONPath = (char *)malloc(utjsonlen + 1);
#endif
Expand Down Expand Up @@ -639,7 +722,7 @@ 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[destination] = str[source];
++destination;
Expand All @@ -663,7 +746,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++;
Comment on lines 746 to 750

Comment on lines 746 to 751
Comment on lines 746 to 751
Comment on lines 746 to 751
Comment on lines 746 to 751
Expand Down
23 changes: 23 additions & 0 deletions src/rrdIarmEvents.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,29 @@ void _rdmManagerEventHandler(const char *owner, IARM_EventId_t eventId, void *da
}
RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: Cache.issueString=%s Cache.issueString.Len=%d\n", __FUNCTION__, __LINE__, cache->issueString, strlen(cache->issueString));
strncpy((char *)sendbuf->mdata, cache->issueString, recPkgNamelen);
if (cache->suffix && cache->suffix[0] != '\0')
{
sendbuf->suffix = strdup(cache->suffix);
RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: Restored suffix from cache struct: %s\n", __FUNCTION__, __LINE__, cache->suffix);
// Append suffix to mdata
size_t mdata_len = strlen(sendbuf->mdata);
size_t suffix_len = strlen(sendbuf->suffix);
Comment on lines +343 to +347
size_t total_len = mdata_len + suffix_len + 1;
char *new_mdata = realloc(sendbuf->mdata, total_len);
if (new_mdata)
{
sendbuf->mdata = new_mdata;
strncat(sendbuf->mdata, sendbuf->suffix, suffix_len);
}
else
{
RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "[%s:%d]: Failed to realloc mdata for suffix append\n", __FUNCTION__, __LINE__);
Comment on lines +344 to +357
}
Comment on lines +344 to +358
Comment on lines +344 to +358
}
Comment on lines 340 to +359
else
{
Comment on lines +341 to +361
Comment on lines +341 to +361
sendbuf->suffix = NULL;
Comment on lines +341 to +362
Comment on lines +341 to +362
}
Comment on lines 340 to +363
RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: IssueType: %s...\n", __FUNCTION__, __LINE__, (char *)sendbuf->mdata);
snprintf(sendbuf->jsonPath, strlen(eventData->rdm_pkg_info.pkg_inst_path) + rrdjsonlen + 1, "%s%s", eventData->rdm_pkg_info.pkg_inst_path, RRD_JSON_FILE);
sendbuf->inDynamic = true;
Expand Down
28 changes: 28 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);
}
free(sbuf);
}
}
Expand Down Expand Up @@ -382,6 +387,29 @@ void _rdmDownloadEventHandler(rbusHandle_t handle, rbusEvent_t const* event, rbu
}
RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: Cache.issueString=%s Cache.issueString.Len=%d\n", __FUNCTION__, __LINE__, cache->issueString, strlen(cache->issueString));
strncpy((char *)sendbuf->mdata, cache->issueString, recPkgNamelen);
if (cache->suffix && cache->suffix[0] != '\0')
{
sendbuf->suffix = strdup(cache->suffix);
RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: Restored suffix from cache struct: %s\n", __FUNCTION__, __LINE__, cache->suffix);
// Append suffix to mdata
size_t mdata_len = strlen(sendbuf->mdata);
size_t suffix_len = strlen(sendbuf->suffix);
size_t total_len = mdata_len + suffix_len + 1;
char *new_mdata = realloc(sendbuf->mdata, total_len);
if (new_mdata)
{
sendbuf->mdata = new_mdata;
strncat(sendbuf->mdata, sendbuf->suffix, suffix_len);
}
else
{
RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "[%s:%d]: Failed to realloc mdata for suffix append\n", __FUNCTION__, __LINE__);
}
Comment on lines +393 to +407
Comment on lines +393 to +407
Comment on lines +393 to +407
Comment on lines +393 to +407
Comment on lines +392 to +407
Comment on lines +393 to +407
Comment on lines +393 to +407
}
else
Comment on lines +390 to +409
{
sendbuf->suffix = NULL;
}
Comment on lines +390 to +412
RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: IssueType: %s...\n", __FUNCTION__, __LINE__, (char *)sendbuf->mdata);
snprintf(sendbuf->jsonPath, strlen(pkg_inst_path) + rrdjsonlen + 1, "%s%s", pkg_inst_path, RRD_JSON_FILE);
sendbuf->inDynamic = true;
Expand Down
Loading
Loading