Skip to content

Feature/rdk 60236 searchremoved dynamic#195

Open
Abhinavpv28 wants to merge 139 commits into
developfrom
feature/RDK-60236_searchremoved_dynamic
Open

Feature/rdk 60236 searchremoved dynamic#195
Abhinavpv28 wants to merge 139 commits into
developfrom
feature/RDK-60236_searchremoved_dynamic

Conversation

@Abhinavpv28
Copy link
Copy Markdown
Contributor

No description provided.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

Code Coverage Summary

                               Total:|84.1%   6291|97.3%  1664|    -      0

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 13 changed files in this pull request and generated 4 comments.

Comment thread src/rrdJsonParser.c
Comment thread src/rrdInterface.c
Comment on lines +393 to +407
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 thread src/rrdIarmEvents.c
Comment on lines +341 to +361
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__);
}
}
else
{
Comment thread src/rrdRunCmdThread.c
Comment on lines 93 to +99
if(cache)
{
cache->mdata = NULL;
cache->issueString = NULL;
cache->next = NULL;
cache->prev = NULL;
cache->mdata = pkgData;
cache->issueString = issueTypeData;
cache->suffix = suffix ? strdup(suffix) : NULL;
cache->next = NULL;
cache->prev = NULL;
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 9, 2026

Code Coverage Summary

                               Total:|84.1%   6299|97.3%  1664|    -      0

Copilot AI review requested due to automatic review settings May 9, 2026 06:16
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 9, 2026

Code Coverage Summary

                               Total:|84.1%   6299|97.3%  1664|    -      0

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 13 changed files in this pull request and generated 3 comments.

Comment thread src/rrdJsonParser.c
Comment thread src/rrdInterface.c
Comment on lines +390 to +412
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__);
}
}
else
{
sendbuf->suffix = NULL;
}
Comment thread src/rrdIarmEvents.c
Comment on lines +341 to +362
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__);
}
}
else
{
sendbuf->suffix = NULL;
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 9, 2026

Code Coverage Summary

                               Total:|84.1%   6301|97.3%  1664|    -      0

Copilot AI review requested due to automatic review settings May 9, 2026 13:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 13 changed files in this pull request and generated 7 comments.

Comments suppressed due to low confidence (1)

src/rrdJsonParser.c:178

  • split_issue_type() is not syntactically complete: the function body never closes (missing closing braces) and the readJsonFile() comment/definition begins while still inside the split_issue_type control flow. This will not compile; please rewrite/simplify the function and ensure all opened blocks are closed before readJsonFile() starts.
    if (split) {
        size_t b_len = (size_t)(split - input);
        if (b_len >= base_len) b_len = base_len - 1;
        strncpy(base, input, b_len);
        base[b_len] = '\0';

        // Suffix logic as before
        if (strlen(split) <= RRD_MAX_SUFFIX_LEN) {
            size_t si = 0, di = 0;
            size_t max_copy = suffix_len - 1;
            while (split[si] != '\0' && di < max_copy) {
                const char *p = input;
                const char *split = NULL;
                size_t appnd_len = strlen(APPEND_SUFFIX);
                int found_appnd = 0;

                while ((p = strchr(p, '_')) != NULL) {
                    if (strncmp(p, APPEND_SUFFIX, appnd_len) == 0) {
                        found_appnd = 1;
                        // Don't skip the underscore, just mark that APPEND_SUFFIX is present
                        p += appnd_len;
                        continue;
                    } else {
                        split = p;
                        break;
                    }
                }

                if (split) {
                    size_t b_len = (size_t)(split - input);
                    if (b_len >= base_len) b_len = base_len - 1;
                    strncpy(base, input, b_len);
                    base[b_len] = '\0';

                    // Suffix logic as before
                    if (strlen(split) <= RRD_MAX_SUFFIX_LEN) {
                        size_t si = 0, di = 0;
                        size_t max_copy = suffix_len - 1;
                        while (split[si] != '\0' && di < max_copy) {
                            char ch = split[si];
                            if (isalnum((unsigned char)ch) || ch == '_' || ch == '-') {
                                suffix[di++] = ch;
                            }
                            si++;
                        }
                        suffix[di] = '\0';
                    } else {
                        RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: Suffix after '%s' exceeds max length (%zu > %d); discarding\n",
                                __FUNCTION__, __LINE__, base, strlen(split), RRD_MAX_SUFFIX_LEN);
                        suffix[0] = '\0';
                    }
                } else {
                    // No split point found
                    // If APPEND_SUFFIX was found, base is the whole input (including _ and APPEND_SUFFIX)
                    strncpy(base, input, base_len - 1);
                    base[base_len - 1] = '\0';
                    suffix[0] = '\0';
                }
 * @brief Reads the JSON file and stores the content in a character array.
 * @param char *jsonfile - The name of the JSON file whose content is to be read.
 * @return char* - A string containing the JSON content, or NULL on failure.
 */
char * readJsonFile(char *jsonfile)

Comment thread src/rrdJsonParser.c
#include <sys/stat.h>
#include <sys/types.h>
#include <ctype.h>
#define RRD_MAX_SUFFIX_LEN 10
Comment thread src/rrdInterface.c
Comment on lines +393 to +407
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 thread src/rrdIarmEvents.c
Comment on lines +344 to +358
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 +2314 to +2323
{
/* "_Random-token" is 13 chars (> 9): suffix discarded; base = "Device.DeviceTime" */
data_buf rbuf = {};
rbuf.mdata = strdup("Device.DeviceTime_Random-token");
rbuf.inDynamic = false;
rbuf.jsonPath = nullptr;
/* Should not crash; long suffix is discarded, base is processed normally */
processIssueTypeEvent(&rbuf);
free(rbuf.mdata);
rbuf.mdata = NULL;
Comment on lines +2340 to +2351
{
/* When the IssueType value from RBUS is whitespace (e.g. a space),
* removeSpecialCharacterfromIssueTypeList() strips it to an empty string.
* processIssueTypeEvent() must detect the post-sanitization empty base
* and skip processing without crashing or invoking processIssueType. */
data_buf rbuf = {};
rbuf.mdata = strdup(" "); /* single space — all-special after split */
rbuf.inDynamic = false;
rbuf.jsonPath = nullptr;
/* Must not crash and must not reach getIssueInfo with an empty mdata */
processIssueTypeEvent(&rbuf);
free(rbuf.mdata);
Comment on lines +2355 to +2365
TEST(ProcessIssueTypeEvntTest, EmptyStringIssueTypeIsSkipped)
{
/* An empty-string mdata must be handled gracefully — issueTypeSplitter
* returns 1 token that is an empty string, which split_issue_type then
* maps to an empty base, causing the entry to be skipped. */
data_buf rbuf = {};
rbuf.mdata = strdup("");
rbuf.inDynamic = false;
rbuf.jsonPath = nullptr;
processIssueTypeEvent(&rbuf);
free(rbuf.mdata);
Comment thread src/rrdJsonParser.c
Comment on lines 51 to +60
/*
* @function getParamcount
* @brief Calculates the total number of nodes (elements) in the input string, excluding delimiters.
* @param char *str - The string from TR181 whose nodes are to be counted.
* @return int - The number of nodes.
* @function split_issue_type
* @brief Utility to split base and suffix from issue type string.
* The input is always split at the first '_'. The base is the part
* before the underscore (never contains '_'). The suffix is only
* kept when its total length (including the leading '_') is at most
* RRD_MAX_SUFFIX_LEN (9) characters; longer suffixes are discarded.
* After length validation the suffix is sanitized: only the characters
* [A-Za-z0-9_-] are retained so that the value is safe to use in file
* names and shell command arguments without risk of injection.
Copilot AI review requested due to automatic review settings May 9, 2026 14:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 13 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

src/rrdJsonParser.c:31

  • RRD_MAX_SUFFIX_LEN is defined as 10, but the docstring below describes the max suffix length (including the leading _) as 9. This inconsistency can cause off-by-one behavior (accepting 10-char suffixes) and makes the boundary unclear. Align the constant with the documented/expected limit (or update the documentation/tests if 10 is intended).
#include <sys/stat.h>
#include <sys/types.h>
#include <ctype.h>
#define RRD_MAX_SUFFIX_LEN  10

/*
 * @function removeSpecialChar
 * @brief Removes special characters ('\r' and '\n') from the device properties parameter string.

Comment thread src/rrdJsonParser.c Outdated
Comment on lines +247 to +294
* @brief Reads the JSON file and stores the content in a character array.
* @param char *jsonfile - The name of the JSON file whose content is to be read.
* @return char* - A string containing the JSON content, or NULL on failure.
*/
char * readJsonFile(char *jsonfile)
{
FILE *fp = NULL;
int ch_count = 0;
char *jsonfile_content = NULL;

RDK_LOG(RDK_LOG_DEBUG,LOG_REMDEBUG,"[%s:%d]: Reading json config file %s \n",__FUNCTION__,__LINE__,jsonfile);
fp = fopen(jsonfile, "r");
if (fp == NULL)
{
RDK_LOG(RDK_LOG_ERROR,LOG_REMDEBUG,"[%s:%d]: Json File %s Read Failed!!! \n",__FUNCTION__,__LINE__,jsonfile);
return NULL;
}
fseek(fp, 0, SEEK_END);
ch_count = ftell(fp);
if(ch_count < 1)
{
RDK_LOG(RDK_LOG_ERROR,LOG_REMDEBUG,"[%s:%d]: Json File %s is Empty!!! \n",__FUNCTION__,__LINE__,jsonfile);
// CID 278332: Resource leak (RESOURCE_LEAK)
fclose(fp);
return NULL;
}
fseek(fp, 0, SEEK_SET);
jsonfile_content = (char *) malloc(sizeof(char) * (ch_count + 1));
if (jsonfile_content == NULL)
{
RDK_LOG(RDK_LOG_ERROR,LOG_REMDEBUG,"[%s:%d]: Memory allocation failed for json file %s \n",__FUNCTION__,__LINE__,jsonfile);
fclose(fp);
return NULL;
}

size_t bytes_read = fread(jsonfile_content, 1, ch_count, fp);
if (bytes_read != (size_t)ch_count)
{
RDK_LOG(RDK_LOG_ERROR,LOG_REMDEBUG,"[%s:%d]: Failed to read json file %s. Expected %d bytes, read %zu bytes \n",__FUNCTION__,__LINE__,jsonfile,ch_count,bytes_read);
free(jsonfile_content);
fclose(fp);
return NULL;
}

jsonfile_content[ch_count] ='\0';
fclose(fp);

return jsonfile_content;
Comment thread src/rrdEventProcess.c
Comment on lines 111 to 116
@@ -88,9 +116,19 @@ void processIssueTypeEvent(data_buf *rbuf)
}
Comment thread src/rrdRunCmdThread.c
cacheData *tmp = createCache(pkgData, issueTypeData, suffix);
if(!tmp)
{
RDK_LOG(RDK_LOG_INFO,LOG_REMDEBUG,"[%s:%d]: Memory Allocation Failed : Cannot Append Item to Cache\n", __FUNCTION__, __LINE__);
Copilot AI review requested due to automatic review settings May 9, 2026 14:30
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 9, 2026

Code Coverage Summary

                               Total:|84.1%   6299|97.3%  1664|    -      0

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 13 changed files in this pull request and generated 6 comments.

Comments suppressed due to low confidence (1)

src/rrdJsonParser.c:31

  • RRD_MAX_SUFFIX_LEN is defined as 10, but the function comment (and tests) describe a max suffix length of 9 characters (including the leading '_'). This makes the length validation ambiguous/off-by-one. Align the macro value, comment, and comparisons so the enforced maximum matches the intended contract.
#include <ctype.h>
#define RRD_MAX_SUFFIX_LEN  10

/*
 * @function removeSpecialChar
 * @brief Removes special characters ('\r' and '\n') from the device properties parameter string.

Comment thread src/rrdInterface.c
Comment on lines +392 to +407
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 thread src/rrdIarmEvents.c
Comment on lines +341 to +362
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__);
}
}
else
{
sendbuf->suffix = NULL;
Comment thread src/rrdJsonParser.c
Comment on lines +124 to +131
/*
* @function split_issue_type
* @brief Utility to split base and suffix from issue type string.
* The input is always split at the first '_'. The base is the part
* before the underscore (never contains '_'). The suffix is only
* kept when its total length (including the leading '_') is at most
* RRD_MAX_SUFFIX_LEN (9) characters; longer suffixes are discarded.
* After length validation the suffix is sanitized: only the characters
Comment thread src/rrdEventProcess.c
Comment on lines 743 to 748
int cnt = 1, i = 0;
char *str = input_str;

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

Comment on lines 1505 to 1511
{
char *pkgData = NULL;
char *issueTypeData = strdup("ValidIssueTypeData");
append_item(pkgData, issueTypeData);
append_item(pkgData, issueTypeData, NULL);

ASSERT_NE(cacheDataNode, nullptr);
ASSERT_EQ(cacheDataNode->mdata, nullptr);
Comment on lines +1752 to 1759
cacheData *firstNode = (cacheData *)calloc(1, sizeof(cacheData));
firstNode->mdata = strdup("FirstPkgData");
firstNode->issueString = strdup("FirstIssueString");
firstNode->next = NULL;
cacheData *secondNode = (cacheData *)malloc(sizeof(cacheData));
cacheData *secondNode = (cacheData *)calloc(1, sizeof(cacheData));
secondNode->mdata = strdup("SecondPkgData");
secondNode->issueString = strdup("SecondIssueString");
secondNode->next = NULL;
Copilot AI review requested due to automatic review settings May 9, 2026 16:37
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 9, 2026

Code Coverage Summary

                               Total:|84.1%   6300|97.3%  1664|    -      0

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 13 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

src/rrdJsonParser.c:31

  • RRD_MAX_SUFFIX_LEN is defined as 10 but the function documentation/logging describes the maximum allowed suffix length as 9 (including the leading '_'), and unit tests in this PR assert 9 as the upper bound. Please align the constant + documentation/tests (e.g., change the define to 9, or update docs/tests if 10 is intended) so the length gate is unambiguous.
#define RRD_MAX_SUFFIX_LEN  10

/*
 * @function removeSpecialChar
 * @brief Removes special characters ('\r' and '\n') from the device properties parameter string.

Comment thread src/rrdInterface.c
Comment on lines +393 to +407
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 thread src/rrdRunCmdThread.c
void append_item(char *pkgData, char *issueTypeData)
void append_item(char *pkgData, char *issueTypeData, char *suffix)
{
RDK_LOG(RDK_LOG_INFO,LOG_REMDEBUG,"[%s:%d]: Append Item with PkgData: %s and issue Type: %s to Cache \n",__FUNCTION__,__LINE__,pkgData,issueTypeData);
Comment thread src/rrdInterface.c
Comment on lines +393 to +407
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 thread src/rrdIarmEvents.c
Comment on lines +344 to +358
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 thread src/rrdIarmEvents.c
Comment on lines +343 to +347
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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants