Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions .github/workflows/L2-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Check out dependent repostiories
uses: actions/checkout@v4
with:
repository: 'rdkcentral/rdm-agent'
path: rdm-agent
Comment on lines +27 to +31

Copilot AI Feb 12, 2026

Copy link

Choose a reason for hiding this comment

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

Spelling: step name says "repostiories". Rename it to "repositories" to avoid confusion in workflow logs.

Copilot uses AI. Check for mistakes.
Comment on lines +27 to +31

Copilot AI Feb 23, 2026

Copy link

Choose a reason for hiding this comment

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

Typo in step name: "repostiories" should be "repositories".

Copilot uses AI. Check for mistakes.

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

Expand All @@ -36,10 +42,18 @@ jobs:
run: |
docker run -d --name mockxconf -p 50050:50050 -p 50051:50051 -p 50052:50052 -e ENABLE_MTLS=true -v ${{ github.workspace }}:/mnt/L2_CONTAINER_SHARED_VOLUME ghcr.io/rdkcentral/docker-device-mgt-service-test/mockxconf:latest

- name: Copy unknown-accountid-xconf-rfc-response json to mockxconf service

Copilot AI Feb 12, 2026

Copy link

Choose a reason for hiding this comment

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

The step name mentions "unknown-accountid-xconf-rfc-response" but the file being copied is test/xconf-certbundle-response.json. Consider aligning the step name with the actual fixture being used so it’s clear what response is being injected into mockxconf.

Suggested change
- name: Copy unknown-accountid-xconf-rfc-response json to mockxconf service
- name: Copy xconf-certbundle-response json to mockxconf service

Copilot uses AI. Check for mistakes.
run: |
docker cp ${{ github.workspace }}/test/xconf-certbundle-response.json mockxconf:/etc/xconf/xconf-certbundle-response.json

- name: Start l2-container service with mTLS enabled
run: |
docker run -d --name native-platform --link mockxconf -e ENABLE_MTLS=true -v ${{ github.workspace }}:/mnt/L2_CONTAINER_SHARED_VOLUME ghcr.io/rdkcentral/docker-device-mgt-service-test/native-platform:latest

- name: Enter Inside container run rdm-agent cov_build.sh
run: |
docker exec -i native-platform /bin/bash -c "cd /mnt/L2_CONTAINER_SHARED_VOLUME/rdm-agent && sh cov_build.sh && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu:/lib/aarch64-linux-gnu:/usr/local/lib: && cp /usr/local/bin/rdm /usr/bin/rdm"

- name: Enter Inside Platform native container and run L2 Test
run: |
docker exec -i native-platform /bin/bash -c "cd /mnt/L2_CONTAINER_SHARED_VOLUME/ && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu:/lib/aarch64-linux-gnu:/usr/local/lib: && sh run_l2.sh"
Expand Down
9 changes: 7 additions & 2 deletions run_l2.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright 2023 Comcast Cable Communications Management, LLC
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down Expand Up @@ -45,7 +45,7 @@ fi
#./cov_build.sh

# Compile Test binary for mfrutils
cc -o /usr/bin/mfr_util test/functional-tests/tests/mfrutils.c
cc -o /usr/bin/mfr_util test/functional-tests/tests/mfrutils.c

rbuscli setv Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.SWDLSpLimit.Enable boolean true
rbuscli setv Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.SWDLSpLimit.TopSpeed int 1280000
Expand Down Expand Up @@ -117,3 +117,8 @@ echo "=========================================="
echo "Image tests report: $RESULT_DIR/rdkfwupdater_image_tests.json"
echo "D-Bus tests report: $RESULT_DIR/rdkfwupdater_dbus_tests.json"
echo "=========================================="

cat /opt/logs/swupdate.txt.0

cat /opt/logs/rdm_status.log

Comment on lines +121 to +124

Copilot AI Feb 23, 2026

Copy link

Choose a reason for hiding this comment

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

These cat commands are the last statements in the script; if either log file is missing, cat will exit non-zero and the whole L2 run step will fail even though tests may have passed. Guard with || true or check file existence before catting.

Suggested change
cat /opt/logs/swupdate.txt.0
cat /opt/logs/rdm_status.log
if [ -f /opt/logs/swupdate.txt.0 ]; then
cat /opt/logs/swupdate.txt.0
else
echo "Log file /opt/logs/swupdate.txt.0 not found."
fi
if [ -f /opt/logs/rdm_status.log ]; then
cat /opt/logs/rdm_status.log
else
echo "Log file /opt/logs/rdm_status.log not found."
fi

Copilot uses AI. Check for mistakes.
5 changes: 3 additions & 2 deletions src/deviceutils/device_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ size_t GetPDRIFileName( char *pPDRIFilename, size_t szBufSize )
RETURN - number of characters copied to the output buffer.
*/

size_t GetInstalledBundles(char *pBundles, size_t szBufSize)
size_t GetInstalledBundles(char *pBundles, size_t szBufSize, const char *bundleType)
{
JSON *pJsonTop;
JSON *pJson;
Expand All @@ -199,7 +199,8 @@ size_t GetInstalledBundles(char *pBundles, size_t szBufSize)
if (pBundles != NULL)
{
*pBundles = 0;
installedBundleListNode = getInstalledBundleFileList();
SWLOG_INFO("GetInstalledBundles: Invoking getInstalledBundleFileList to get %s bundle list ",bundleType);

Copilot AI Feb 12, 2026

Copy link

Choose a reason for hiding this comment

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

GetInstalledBundles logs bundleType with %s but does not validate it first. If a caller passes NULL, this is undefined behavior and can crash before getInstalledBundleFileList can reject it. Add a NULL/empty check at the start of GetInstalledBundles (or log with a safe fallback like (bundleType ? bundleType : "<null>")).

Suggested change
SWLOG_INFO("GetInstalledBundles: Invoking getInstalledBundleFileList to get %s bundle list ",bundleType);
SWLOG_INFO("GetInstalledBundles: Invoking getInstalledBundleFileList to get %s bundle list ",
(bundleType ? bundleType : "<null>"));

Copilot uses AI. Check for mistakes.
installedBundleListNode = getInstalledBundleFileList(bundleType);

while (installedBundleListNode != NULL)
{
Expand Down
4 changes: 3 additions & 1 deletion src/deviceutils/device_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,11 @@ size_t GetPDRIFileName(char *pPDRIFilename, size_t szBufSize);

szBufSize - the size of the character buffer in argument 1.

bundleType - type of the bundle.

RETURN - number of characters copied to the output buffer.
*/
size_t GetInstalledBundles(char *pBundles, size_t szBufSize);
size_t GetInstalledBundles(char *pBundles, size_t szBufSize, const char *bundleType);
Comment on lines 143 to +150

Copilot AI Feb 12, 2026

Copy link

Choose a reason for hiding this comment

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

The comment block for GetInstalledBundles still lists the old 2-parameter usage line even though the function now requires bundleType. Update the doc comment so the usage/signature and parameter descriptions match.

Copilot uses AI. Check for mistakes.
/* function GetPartnerId - gets the partner ID of the device.

Usage: size_t GetPartnerId <char *pPartnerId> <size_t szBufSize>
Expand Down
39 changes: 32 additions & 7 deletions src/deviceutils/deviceutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ int v_secure_pclose(FILE *fp);
#include <dirent.h>

#ifndef GTEST_ENABLE
#define BUNDLE_METADATA_NVM_PATH "/media/apps/etc/certs"
#define BUNDLE_METADATA_RFS_PATH "/etc/certs"
#define BUNDLE_METADATA_NVM_CERT_PATH "/media/apps/etc/certs"
#define BUNDLE_METADATA_RFS_CERT_PATH "/etc/certs"
#define BUNDLE_METADATA_NVM_APPS_PATH "/media/apps/etc/apps"
#define BUNDLE_METADATA_RFS_APPS_PATH "/etc/apps"
#else
#define BUNDLE_METADATA_NVM_PATH "/tmp/certs"
#define BUNDLE_METADATA_RFS_PATH "/tmp/rfc/certs"
#define BUNDLE_METADATA_NVM_CERT_PATH "/tmp/certs"
#define BUNDLE_METADATA_RFS_CERT_PATH "/tmp/rfc/certs"
#define BUNDLE_METADATA_NVM_APPS_PATH "/media/apps/etc/apps"
#define BUNDLE_METADATA_RFS_APPS_PATH "/etc/apps"
Comment on lines +52 to +53

Copilot AI Feb 12, 2026

Copy link

Choose a reason for hiding this comment

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

Under GTEST_ENABLE, cert bundle paths are redirected to /tmp/..., but app bundle paths still point at production locations (/media/apps/etc/apps, /etc/apps). This makes unit/integration tests that exercise dlAppBundle behavior difficult to set up consistently. Consider using test-only /tmp paths for app bundles under GTEST_ENABLE, similar to cert bundles.

Suggested change
#define BUNDLE_METADATA_NVM_APPS_PATH "/media/apps/etc/apps"
#define BUNDLE_METADATA_RFS_APPS_PATH "/etc/apps"
#define BUNDLE_METADATA_NVM_APPS_PATH "/tmp/apps"
#define BUNDLE_METADATA_RFS_APPS_PATH "/tmp/rfc/apps"

Copilot uses AI. Check for mistakes.
#endif

#define WPEFRAMEWORKSECURITYUTILITY "/usr/bin/WPEFrameworkSecurityUtility"
Expand Down Expand Up @@ -375,8 +379,29 @@ int getJRPCTokenData( char *token, char *pJsonStr, unsigned int token_size )
Input : void
RETURN - List of installed Bundle in NVM and RFS directory
*/
metaDataFileList_st *getInstalledBundleFileList()
metaDataFileList_st *getInstalledBundleFileList(const char *bundleType)
{
const char *BUNDLE_METADATA_NVM_PATH = NULL;
const char *BUNDLE_METADATA_RFS_PATH = NULL;

if (bundleType == NULL || bundleType[0] == '\0') {
SWLOG_ERROR("getInstalledBundleFileList: bundleType is NULL or empty\n");
return NULL;
}

if (strcmp(bundleType, "dlCertBundle") == 0) {
SWLOG_INFO("Setting bundle path for installed Cert packages\n");
BUNDLE_METADATA_NVM_PATH = BUNDLE_METADATA_NVM_CERT_PATH;
BUNDLE_METADATA_RFS_PATH = BUNDLE_METADATA_RFS_CERT_PATH;
} else if (strcmp(bundleType, "dlAppBundle") == 0) {
SWLOG_INFO("Setting bundle path for installed App packages\n");
BUNDLE_METADATA_NVM_PATH = BUNDLE_METADATA_NVM_APPS_PATH;
BUNDLE_METADATA_RFS_PATH = BUNDLE_METADATA_RFS_APPS_PATH;
} else {
Comment on lines +396 to +400

Copilot AI Feb 23, 2026

Copy link

Choose a reason for hiding this comment

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

dlAppBundle handling is introduced here, but current unit tests only cover cert bundle discovery/parsing. Please add/extend gtests to cover dlAppBundle path selection and metadata parsing (NVM/RFS) and unknown bundleType handling.

Copilot uses AI. Check for mistakes.
SWLOG_ERROR("Unknown bundleType: %s\n", bundleType);
return NULL;
}

metaDataFileList_st *metadataNVMls = NULL, *metadataRFSls = NULL, *metaDataList = NULL;

metadataNVMls = getMetaDataFile(BUNDLE_METADATA_NVM_PATH);
Expand Down Expand Up @@ -414,11 +439,11 @@ metaDataFileList_st *getInstalledBundleFileList()
}

/* function getMetaDataFile - gets the files list in the directory
Usage: metaDataFileList_st *getMetaDataFile(char *dir)
Usage: metaDataFileList_st *getMetaDataFile(const char *dir)
dir : directory of NVM or RFS Path
RETURN - List of installed Bundle in NVM or RFS directory
*/
metaDataFileList_st *getMetaDataFile(char *dir)
metaDataFileList_st *getMetaDataFile(const char *dir)
{
metaDataFileList_st *newnode = NULL, *prevnode = NULL, *headNode = NULL;
struct dirent *pDirent = NULL;
Expand Down
4 changes: 2 additions & 2 deletions src/deviceutils/deviceutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ int getJsonRpc(char *post_data, DownloadData* pJsonRpc);
* */
int getJRPCTokenData(char *token, char *pJsonStr, unsigned int token_size);

metaDataFileList_st *getInstalledBundleFileList();
metaDataFileList_st *getMetaDataFile(char *dir);
metaDataFileList_st *getInstalledBundleFileList(const char *bundleType);
metaDataFileList_st *getMetaDataFile(const char *dir);
metaDataFileList_st * mergeLists(metaDataFileList_st *nvmList, metaDataFileList_st *rfsList);


Expand Down
1 change: 1 addition & 0 deletions src/include/json_process.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ typedef struct xconf_response {
char cloudImmediateRebootFlag[12];
char peripheralFirmwares[256];
char dlCertBundle[64];
char dlAppBundle[64];
char cloudPDRIVersion[64];
char rdmCatalogueVersion[512];
} XCONFRES;
Expand Down
52 changes: 43 additions & 9 deletions src/json_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,22 @@ size_t createJsonString( char *pPostFieldOut, size_t szPostFieldOut )
remainlen = szPostFieldOut - totlen;
totlen += snprintf( (pTmpPost + totlen), remainlen, "localtime=%s", tmpbuf );
}
len = GetInstalledBundles( tmpbuf, sizeof(tmpbuf) );
len = GetInstalledBundles( tmpbuf, sizeof(tmpbuf), "dlCertBundle" );
if( totlen )
{
*(pTmpPost + totlen) = '&';
++totlen;
}
remainlen = szPostFieldOut - totlen;
totlen += snprintf( (pTmpPost + totlen), remainlen, "dlCertBundle=%s", tmpbuf );
len = GetInstalledBundles( tmpbuf, sizeof(tmpbuf), "dlAppBundle" );
if( totlen )
{
*(pTmpPost + totlen) = '&';
++totlen;
}
remainlen = szPostFieldOut - totlen;
totlen += snprintf( (pTmpPost + totlen), remainlen, "dlAppBundle=%s", tmpbuf );
Comment on lines +219 to +226

Copilot AI Feb 12, 2026

Copy link

Choose a reason for hiding this comment

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

createJsonString appends dlAppBundle using totlen += snprintf(...) without checking for truncation. If snprintf returns >= remainlen, totlen can exceed szPostFieldOut, causing remainlen underflow and potential out-of-bounds writes in subsequent appends. Please check the snprintf return value and stop/return an error when truncation occurs (and consider applying the same pattern to the existing dlCertBundle append).

Copilot uses AI. Check for mistakes.
len = GetRdmManifestVersion( tmpbuf, sizeof(tmpbuf) );
if( totlen )
{
Expand Down Expand Up @@ -272,6 +280,7 @@ int getXconfRespData( XCONFRES *pResponse, char *pJsonStr )
GetJsonValContaining( pJson, "remCtrl", pResponse->peripheralFirmwares, sizeof(pResponse->peripheralFirmwares) );
t2ValNotify("SYST_INFO_PRXR_Ver_split", pResponse->peripheralFirmwares);
GetJsonVal( pJson, "dlCertBundle", pResponse->dlCertBundle, sizeof(pResponse->dlCertBundle) );
GetJsonVal( pJson, "dlAppBundle", pResponse->dlAppBundle, sizeof(pResponse->dlAppBundle) );
strncmp(pResponse->dlCertBundle, "lxyupdate-bundle:", 17)?1:t2ValNotify("lxybundleversion_split", pResponse->dlCertBundle + 17);
GetJsonVal( pJson, "rdmCatalogueVersion", pResponse->rdmCatalogueVersion, sizeof(pResponse->rdmCatalogueVersion) );
GetJsonVal( pJson, "ipv6FirmwareLocation", pResponse->ipv6cloudFWLocation, sizeof(pResponse->ipv6cloudFWLocation) );
Expand Down Expand Up @@ -334,6 +343,7 @@ int processJsonResponse(XCONFRES *response, const char *myfwversion, const char
SWLOG_INFO("cloudImmediateRebootFlag: %s\n", response->cloudImmediateRebootFlag);
SWLOG_INFO("peripheralFirmwares: %s\n", response->peripheralFirmwares);
SWLOG_INFO("dlCertBundle: %s\n", response->dlCertBundle);
SWLOG_INFO("dlAppBundle: %s\n", response->dlAppBundle);
SWLOG_INFO("cloudPDRIVersion: %s\n", response->cloudPDRIVersion);
SWLOG_INFO("rdmCatalogueVersion: %s\n", response->rdmCatalogueVersion);

Expand All @@ -350,17 +360,41 @@ int processJsonResponse(XCONFRES *response, const char *myfwversion, const char
fprintf( fp, "%s\n", response->rdmCatalogueVersion );
fclose( fp );
}
if (response->dlCertBundle[0] != 0) {
if (response->dlCertBundle[0] != 0 || response->dlAppBundle[0] != '\0') {
SWLOG_INFO("Calling rdm Versioned_app download to process bundle update\n");
if (access("/usr/bin/rdm", F_OK) == 0) {

char dlBundle[1024] = {0};
size_t available = sizeof(dlBundle);

if (response->dlCertBundle[0] != '\0') {
int retval = snprintf(dlBundle, available, "dlCertBundle=%s", response->dlCertBundle);
if (retval < 0 || retval >= available) {
SWLOG_ERROR("dlCertBundle string too long, truncation occurred\n");
return ret;
}
}

if (response->dlAppBundle[0] != '\0') {
size_t current_len = strlen(dlBundle);
available = sizeof(dlBundle) - current_len;

int retval;
if (dlBundle[0] != '\0') {
retval = snprintf(dlBundle + current_len, available, "|dlAppBundle=%s", response->dlAppBundle);
} else {
retval = snprintf(dlBundle + current_len, available, "dlAppBundle=%s", response->dlAppBundle);
}

if (retval < 0 || retval >= available) {
SWLOG_ERROR("dlAppBundle string too long, truncation occurred\n");
return ret;
}
}

if ((access("/usr/bin/rdm", F_OK) == 0) && (strlen(dlBundle) > 0)) {
// file exists
SWLOG_INFO("RDM binary is present\n");
v_secure_system("rdm -v \"%s\" >> /opt/logs/rdm_status.log 2>&1", response->dlCertBundle);
SWLOG_INFO("RDM Versioned app Download started and completed\n");
} else if (access("/etc/rdm/rdmBundleMgr.sh", F_OK) == 0) {
// Script file exist
SWLOG_INFO("RDM binary is not present, using scripts\n");
v_secure_system("sh /etc/rdm/rdmBundleMgr.sh '%s' '%s' >> /opt/logs/rdm_status.log 2>&1", response->dlCertBundle, response->cloudFWLocation);
v_secure_system("rdm -v \"%s\" >> /opt/logs/rdm_status.log 2>&1", dlBundle);
SWLOG_INFO("RDM Versioned app Download started and completed\n");
Comment on lines +394 to 398

Copilot AI Feb 23, 2026

Copy link

Choose a reason for hiding this comment

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

Bundle-update execution now only runs when /usr/bin/rdm exists; the fallback path for /etc/rdm/rdmBundleMgr.sh is no longer present. If some targets still rely on the script-based path, bundle updates will now fail with only a log message. Consider restoring the fallback or explicitly dropping script support (with release notes).

Copilot uses AI. Check for mistakes.
} else {
// file doesn't exist
Expand Down
1 change: 1 addition & 0 deletions src/rdkv_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,7 @@ int main(int argc, char *argv[]) {
*response.cloudImmediateRebootFlag = 0;
*response.peripheralFirmwares = 0;
*response.dlCertBundle = 0;
*response.dlAppBundle = 0;
*response.cloudPDRIVersion = 0;
SWLOG_INFO("Starting c method rdkvfwupgrader\n");
t2CountNotify("SYST_INFO_C_CDL", 1);
Expand Down
1 change: 1 addition & 0 deletions test/xconf-certbundle-response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"additionalFwVerInfo":"ABCD_PDRI_firmware_test","firmwareDownloadProtocol":"http","firmwareFilename":"ABCD_firmware_test.bin","firmwareLocation":"https://mockxconf:50052/getfirmwarefile/","firmwareVersion":"ABCD_firmware_test","rebootImmediately":false,"remCtrlAB11-20":"AB11-20_firmware_5103.3.4","dlCertBundle":"ca-store-update-bundle:0.1","dlAppBundle" : "XApp:1.0, YApp:2.0"}
8 changes: 4 additions & 4 deletions unittest/deviceutils/device_api_gtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,14 @@ TEST(TestGetPDRIFileName, Test_pdri_Nullcheck)
}
TEST_F(DeviceApiTestFixture,TestName_bundle_Nullcheck)
{
EXPECT_EQ(GetInstalledBundles(NULL, 0), 0);
EXPECT_EQ(GetInstalledBundles(NULL, 0, "dlCertBundle"), 0);
}
TEST_F(DeviceApiTestFixture,TestName_bundle_Success)
{
int ret;
char pBundles[32] = {0};
ret = system("mkdir /tmp/certs;cp ca-store-update-bundle_package.json /tmp/certs/ ");
EXPECT_NE(GetInstalledBundles(pBundles, sizeof(pBundles)), 0);
EXPECT_NE(GetInstalledBundles(pBundles, sizeof(pBundles), "dlCertBundle"), 0);
ret = system("rm -rf /tmp/certs/ ");
printf("BUNDLE = %s\n",pBundles);
}
Expand All @@ -212,15 +212,15 @@ TEST_F(DeviceApiTestFixture,TestName_bundle_rfcpath)
int ret;
char pBundles[32] = {0};
ret = system("mkdir /tmp/rfc;mkdir /tmp/rfc/certs; cp ca-store-update-bundle_package.json /tmp/rfc/certs/ ");
EXPECT_NE(GetInstalledBundles(pBundles, sizeof(pBundles)), 0);
EXPECT_NE(GetInstalledBundles(pBundles, sizeof(pBundles), "dlCertBundle"), 0);
ret = system("rm -rf /tmp/rfc/certs/ ");
ret = system("rm -rf /tmp/rfc/ ");
printf("BUNDLE = %s\n",pBundles);
}
TEST_F(DeviceApiTestFixture,TestName_bundle_Fail)
{
char pBundles[32] = {0};
EXPECT_EQ(GetInstalledBundles(pBundles, sizeof(pBundles)), 0);
EXPECT_EQ(GetInstalledBundles(pBundles, sizeof(pBundles), "dlCertBundle"), 0);
}

/* COMMENTED OUT: GetUTCTime and GetCapabilities are now in common_utilities
Expand Down
2 changes: 1 addition & 1 deletion unittest/deviceutils/deviceutils_gtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ TEST_F(DeviceUtilsTestFixture, TestName_getJsonRpc_Fail)
TEST_F(DeviceUtilsTestFixture, TestName_getInstalledBundleFileList_Fail)
{
metaDataFileList_st *meta_ret = NULL;
EXPECT_EQ(getInstalledBundleFileList(), meta_ret);
EXPECT_EQ(getInstalledBundleFileList(NULL), meta_ret);
}
TEST_F(DeviceUtilsTestFixture, TestName_getMetaDataFile_Null)
{
Expand Down
4 changes: 2 additions & 2 deletions unittest/mocks/device_status_helper_mock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ extern "C" size_t GetUTCTime( char *pUTCTime, size_t szBufSize )
return g_DeviceStatusMock->GetUTCTime(pUTCTime, szBufSize);
}

extern "C" size_t GetInstalledBundles(char *pBundles, size_t szBufSize)
extern "C" size_t GetInstalledBundles(char *pBundles, size_t szBufSize, const char *bundleType)
{
if (!g_DeviceStatusMock)
{
Expand All @@ -214,7 +214,7 @@ extern "C" size_t GetInstalledBundles(char *pBundles, size_t szBufSize)
}

Copilot AI Feb 12, 2026

Copy link

Choose a reason for hiding this comment

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

This mock calls snprintf(pBundles, ...) unconditionally once g_DeviceStatusMock is non-null. If a caller passes pBundles == NULL or szBufSize == 0, this will crash/UB. Add the same buffer NULL/size guard used in other mocks before writing to pBundles.

Suggested change
}
}
if (!pBundles || szBufSize == 0)
{
cout << "GetInstalledBundles invalid buffer" << endl;
return 0;
}

Copilot uses AI. Check for mistakes.
printf("Inside Mock Function GetInstalledBundles\n");
snprintf(pBundles, szBufSize, "%s", "castore");
return g_DeviceStatusMock->GetInstalledBundles(pBundles, szBufSize);
return g_DeviceStatusMock->GetInstalledBundles(pBundles, szBufSize, bundleType);
}
extern "C" size_t GetRdmManifestVersion( char *pRdmManifestVersion, size_t szBufSize )
{
Expand Down
4 changes: 2 additions & 2 deletions unittest/mocks/device_status_helper_mock.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class DeviceStatusInterface
virtual size_t GetAccountID( char *pAccountID, size_t szBufSize ) = 0;
virtual size_t GetSerialNum( char *pSerialNum, size_t szBufSize ) = 0;
virtual size_t GetUTCTime( char *pUTCTime, size_t szBufSize ) = 0;
virtual size_t GetInstalledBundles(char *pBundles, size_t szBufSize) = 0;
virtual size_t GetInstalledBundles(char *pBundles, size_t szBufSize, const char *bundleType) = 0;
virtual size_t GetRdmManifestVersion( char *pRdmManifestVersion, size_t szBufSize ) = 0;
virtual size_t GetTimezone( char *pTimezone, const char *cpuArch, size_t szBufSize ) = 0;
virtual size_t GetCapabilities( char *pCapabilities, size_t szBufSize ) = 0;
Expand Down Expand Up @@ -81,7 +81,7 @@ class DeviceStatusMock: public DeviceStatusInterface
MOCK_METHOD(size_t, GetAccountID, ( char *pAccountID, size_t szBufSize ), ());
MOCK_METHOD(size_t, GetSerialNum, ( char *pSerialNum, size_t szBufSize ), ());
MOCK_METHOD(size_t, GetUTCTime, ( char *pUTCTime, size_t szBufSize ), ());
MOCK_METHOD(size_t, GetInstalledBundles, (char *pBundles, size_t szBufSize), ());
MOCK_METHOD(size_t, GetInstalledBundles, (char *pBundles, size_t szBufSize, const char *bundleType), ());
MOCK_METHOD(size_t, GetRdmManifestVersion, ( char *pRdmManifestVersion, size_t szBufSize ), ());
MOCK_METHOD(size_t, GetTimezone, ( char *pTimezone, const char *cpuArch, size_t szBufSize ), ());
MOCK_METHOD(size_t, GetCapabilities, ( char *pCapabilities, size_t szBufSize ), ());
Expand Down
2 changes: 1 addition & 1 deletion unittest/mocks/rdkFwupdateMgr_mock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ extern "C" size_t GetUTCTime(char *pUTCTime, size_t szBufSize) {
return strlen(pUTCTime);
}

extern "C" size_t GetInstalledBundles(char *pBundles, size_t szBufSize) {
extern "C" size_t GetInstalledBundles(char *pBundles, size_t szBufSize, const char *bundleType) {
if (pBundles && szBufSize > 0) {
strncpy(pBundles, "bundle1,bundle2", szBufSize - 1);
pBundles[szBufSize - 1] = '\0';
Expand Down
Loading