Skip to content

Conversation

@smanes0213
Copy link
Contributor

No description provided.

@smanes0213 smanes0213 requested a review from a team as a code owner October 30, 2025 10:47
stateFound = true;
}
if (key == "substate") {
substate = value;
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Variable copied when it could be moved

"value" is copied in call to copy assignment for class "std::string", when it could be moved instead.

Low Impact, CWE-none
COPY_INSTEAD_OF_MOVE

How to fix

Use "std::move(""value"")" instead of "value".

std::ofstream script("/lib/rdk/imageFlasher.sh");
script << "#!/bin/sh\nexit 0\n";
}
chmod("/lib/rdk/imageFlasher.sh", 0755);
Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Oct 30, 2025

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "chmod("/lib/rdk/imageFlasher.sh", 493U)" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

std::this_thread::sleep_for(std::chrono::milliseconds(900));
EXPECT_NE(0, access(headerFile.c_str(), F_OK)); // Header file should be deleted

std::remove("/etc/device.properties");
Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Oct 30, 2025

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/etc/device.properties")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

EXPECT_NE(0, access(headerFile.c_str(), F_OK)); // Header file should be deleted

std::remove("/etc/device.properties");
std::remove("/lib/rdk/imageFlasher.sh");
Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Oct 30, 2025

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/lib/rdk/imageFlasher.sh")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

std::ofstream script("/lib/rdk/imageFlasher.sh");
script << "#!/bin/sh\nexit 0\n";
}
chmod("/lib/rdk/imageFlasher.sh", 0755);
Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Oct 30, 2025

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "chmod("/lib/rdk/imageFlasher.sh", 493U)" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN


/* Test: Notification Register/Unregister around a successful update (event delivery check) */
TEST_F(FirmwareUpdateTest, Notification_ReceiveUpdateStateChange) {
system("mkdir -p /lib/rdk");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value

Calling "system" without checking return value (as is done elsewhere 3 out of 3 times).

Medium Impact, CWE-252
CHECKED_RETURN

// Non-mediaclient success triggers FLASHING_SUCCEEDED via usb path then WAITING_FOR_REBOOT
EXPECT_TRUE(state == "FLASHING_SUCCEEDED" || state == "WAITING_FOR_REBOOT");

std::remove("/etc/device.properties");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/etc/device.properties")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

EXPECT_TRUE(state == "FLASHING_SUCCEEDED" || state == "WAITING_FOR_REBOOT");

std::remove("/etc/device.properties");
std::remove("/lib/rdk/imageFlasher.sh");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/lib/rdk/imageFlasher.sh")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

// Firmware file should be deleted on success for mediaclient
EXPECT_NE(0, access(TEST_FIRMWARE_PATH.c_str(), F_OK));

std::remove("/etc/device.properties");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/etc/device.properties")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

EXPECT_NE(0, access(TEST_FIRMWARE_PATH.c_str(), F_OK));

std::remove("/etc/device.properties");
std::remove("/lib/rdk/imageFlasher.sh");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/lib/rdk/imageFlasher.sh")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN


std::this_thread::sleep_for(std::chrono::milliseconds(800));

std::remove("/etc/device.properties");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/etc/device.properties")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

std::this_thread::sleep_for(std::chrono::milliseconds(800));

std::remove("/etc/device.properties");
std::remove("/lib/rdk/imageFlasher.sh");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/lib/rdk/imageFlasher.sh")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN


std::remove("/etc/device.properties");
std::remove("/lib/rdk/imageFlasher.sh");
std::remove("/opt/swupdate_maintenance_upgrade");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/opt/swupdate_maintenance_upgrade")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN


/* Test: UpdateFirmware Failure Path (non-mediaclient x86) ensures state FAILED and file retained */
TEST_F(FirmwareUpdateTest, UpdateFirmware_FlashImage_Failure_NonMediaClient_X86) {
system("mkdir -p /lib/rdk");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value

Calling "system" without checking return value (as is done elsewhere 3 out of 3 times).

Medium Impact, CWE-252
CHECKED_RETURN

uint32_t rc2 = handler.Invoke(connection, _T("updateFirmware"), req2, response);
EXPECT_NE(Core::ERROR_NONE, rc2); // Should return in-progress error code

std::remove("/etc/device.properties");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/etc/device.properties")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN


/* Test: Notification Register/Unregister around a successful update (event delivery check) */
TEST_F(FirmwareUpdateTest, Notification_ReceiveUpdateStateChange) {
system("mkdir -p /lib/rdk");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value

Calling "system" without checking return value (as is done elsewhere 3 out of 3 times).

Medium Impact, CWE-252
CHECKED_RETURN

// Non-mediaclient success triggers FLASHING_SUCCEEDED via usb path then WAITING_FOR_REBOOT
EXPECT_TRUE(state == "FLASHING_SUCCEEDED" || state == "WAITING_FOR_REBOOT");

std::remove("/etc/device.properties");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/etc/device.properties")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

EXPECT_TRUE(state == "FLASHING_SUCCEEDED" || state == "WAITING_FOR_REBOOT");

std::remove("/etc/device.properties");
std::remove("/lib/rdk/imageFlasher.sh");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/lib/rdk/imageFlasher.sh")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

// Firmware file should be deleted on success for mediaclient
EXPECT_NE(0, access(TEST_FIRMWARE_PATH.c_str(), F_OK));

std::remove("/etc/device.properties");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/etc/device.properties")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

EXPECT_NE(0, access(TEST_FIRMWARE_PATH.c_str(), F_OK));

std::remove("/etc/device.properties");
std::remove("/lib/rdk/imageFlasher.sh");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/lib/rdk/imageFlasher.sh")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN


/* Test: UpdateFirmware Request Accepted for MediaClient Device */
TEST_F(FirmwareUpdateTest, UpdateFirmware_FlashImage_MediaClient_RequestAccepted) {
system("mkdir -p /lib/rdk");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value

Calling "system" without checking return value (as is done elsewhere 3 out of 3 times).

Medium Impact, CWE-252
CHECKED_RETURN

std::ofstream script("/lib/rdk/imageFlasher.sh");
script << "#!/bin/sh\nexit 0\n";
}
chmod("/lib/rdk/imageFlasher.sh", 0755);
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "chmod("/lib/rdk/imageFlasher.sh", 493U)" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

std::ofstream script("/lib/rdk/imageFlasher.sh");
script << "#!/bin/sh\necho 'Flashing...'\nexit 0\n";
}
chmod("/lib/rdk/imageFlasher.sh", 0755);
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "chmod("/lib/rdk/imageFlasher.sh", 493U)" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN


/* Test: UpdateFirmware State Progression for MediaClient Success */
TEST_F(FirmwareUpdateTest, UpdateFirmware_FlashImage_Success_StateProgression) {
system("mkdir -p /lib/rdk");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value

Calling "system" without checking return value (as is done elsewhere 3 out of 3 times).

Medium Impact, CWE-252
CHECKED_RETURN


FirmwareUpdateImpl->Unregister(notify.get());

std::remove("/etc/device.properties");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/etc/device.properties")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN


/* Test: flashImage failure with maintenance mode true for mediaclient */
TEST_F(FirmwareUpdateTest, UpdateFirmware_FlashImage_Failure_MaintenanceMode_MediaClient) {
system("mkdir -p /lib/rdk /opt");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value

Calling "system" without checking return value (as is done elsewhere 3 out of 3 times).

Medium Impact, CWE-252
CHECKED_RETURN

std::ofstream script("/lib/rdk/imageFlasher.sh");
script << "#!/bin/sh\nexit 2\n";
}
chmod("/lib/rdk/imageFlasher.sh", 0755);
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "chmod("/lib/rdk/imageFlasher.sh", 493U)" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN


/* Test: Notification Register/Unregister around a successful update (event delivery check) */
TEST_F(FirmwareUpdateTest, Notification_ReceiveUpdateStateChange) {
system("mkdir -p /lib/rdk");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value

Calling "system" without checking return value (as is done elsewhere 3 out of 3 times).

Medium Impact, CWE-252
CHECKED_RETURN

// Non-mediaclient success triggers FLASHING_SUCCEEDED via usb path then WAITING_FOR_REBOOT
EXPECT_TRUE(state == "FLASHING_SUCCEEDED" || state == "WAITING_FOR_REBOOT");

std::remove("/etc/device.properties");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/etc/device.properties")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

EXPECT_TRUE(state == "FLASHING_SUCCEEDED" || state == "WAITING_FOR_REBOOT");

std::remove("/etc/device.properties");
std::remove("/lib/rdk/imageFlasher.sh");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/lib/rdk/imageFlasher.sh")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN


/* Test: UpdateFirmware Request Validation - MediaClient Device Type Detected */
TEST_F(FirmwareUpdateTest, UpdateFirmware_MediaClient_DeviceTypeCheck) {
system("mkdir -p /lib/rdk");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value

Calling "system" without checking return value (as is done elsewhere 3 out of 3 times).

Medium Impact, CWE-252
CHECKED_RETURN

std::ofstream script("/lib/rdk/imageFlasher.sh");
script << "#!/bin/sh\nexit 0\n";
}
chmod("/lib/rdk/imageFlasher.sh", 0755);
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "chmod("/lib/rdk/imageFlasher.sh", 493U)" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

// Wait long enough for thread to fully complete
std::this_thread::sleep_for(std::chrono::milliseconds(3000));

std::remove("/etc/device.properties");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/etc/device.properties")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

std::this_thread::sleep_for(std::chrono::milliseconds(3000));

std::remove("/etc/device.properties");
std::remove("/lib/rdk/imageFlasher.sh");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/lib/rdk/imageFlasher.sh")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

std::ofstream script("/lib/rdk/imageFlasher.sh");
script << "#!/bin/sh\nexit 0\n";
}
chmod("/lib/rdk/imageFlasher.sh", 0755);
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "chmod("/lib/rdk/imageFlasher.sh", 493U)" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN


/* Test: flashImage failure with maintenance mode true for mediaclient */
TEST_F(FirmwareUpdateTest, UpdateFirmware_FlashImage_Failure_MaintenanceMode_MediaClient) {
system("mkdir -p /lib/rdk /opt");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value

Calling "system" without checking return value (as is done elsewhere 3 out of 3 times).

Medium Impact, CWE-252
CHECKED_RETURN

std::ofstream script("/lib/rdk/imageFlasher.sh");
script << "#!/bin/sh\nexit 2\n";
}
chmod("/lib/rdk/imageFlasher.sh", 0755);
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "chmod("/lib/rdk/imageFlasher.sh", 493U)" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN


/* Test: Notification Register/Unregister around a successful update (event delivery check) */
TEST_F(FirmwareUpdateTest, Notification_ReceiveUpdateStateChange) {
system("mkdir -p /lib/rdk");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value

Calling "system" without checking return value (as is done elsewhere 3 out of 3 times).

Medium Impact, CWE-252
CHECKED_RETURN

// Non-mediaclient success triggers FLASHING_SUCCEEDED via usb path then WAITING_FOR_REBOOT
EXPECT_TRUE(state == "FLASHING_SUCCEEDED" || state == "WAITING_FOR_REBOOT");

std::remove("/etc/device.properties");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/etc/device.properties")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

EXPECT_TRUE(state == "FLASHING_SUCCEEDED" || state == "WAITING_FOR_REBOOT");

std::remove("/etc/device.properties");
std::remove("/lib/rdk/imageFlasher.sh");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/lib/rdk/imageFlasher.sh")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN


/* Test: UpdateFirmware Request Validation - MediaClient Device Type Detected */
TEST_F(FirmwareUpdateTest, UpdateFirmware_MediaClient_DeviceTypeCheck) {
system("mkdir -p /lib/rdk");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value

Calling "system" without checking return value (as is done elsewhere 3 out of 3 times).

Medium Impact, CWE-252
CHECKED_RETURN

std::ofstream script("/lib/rdk/imageFlasher.sh");
script << "#!/bin/sh\nexit 0\n";
}
chmod("/lib/rdk/imageFlasher.sh", 0755);
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "chmod("/lib/rdk/imageFlasher.sh", 493U)" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

// Wait long enough for thread to fully complete
std::this_thread::sleep_for(std::chrono::milliseconds(3000));

std::remove("/etc/device.properties");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/etc/device.properties")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

std::this_thread::sleep_for(std::chrono::milliseconds(3000));

std::remove("/etc/device.properties");
std::remove("/lib/rdk/imageFlasher.sh");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/lib/rdk/imageFlasher.sh")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

std::ofstream script("/lib/rdk/imageFlasher.sh");
script << "#!/bin/sh\nexit 0\n";
}
chmod("/lib/rdk/imageFlasher.sh", 0755);
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "chmod("/lib/rdk/imageFlasher.sh", 493U)" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN


/* Test: flashImage failure with maintenance mode true for mediaclient */
TEST_F(FirmwareUpdateTest, UpdateFirmware_FlashImage_Failure_MaintenanceMode_MediaClient) {
system("mkdir -p /lib/rdk /opt");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value

Calling "system" without checking return value (as is done elsewhere 3 out of 3 times).

Medium Impact, CWE-252
CHECKED_RETURN

std::ofstream script("/lib/rdk/imageFlasher.sh");
script << "#!/bin/sh\nexit 2\n";
}
chmod("/lib/rdk/imageFlasher.sh", 0755);
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "chmod("/lib/rdk/imageFlasher.sh", 493U)" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN


/* Test: Notification Register/Unregister around a successful update (event delivery check) */
TEST_F(FirmwareUpdateTest, Notification_ReceiveUpdateStateChange) {
system("mkdir -p /lib/rdk");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value

Calling "system" without checking return value (as is done elsewhere 3 out of 3 times).

Medium Impact, CWE-252
CHECKED_RETURN

state == "VALIDATION_COMPLETE");
}

std::remove("/etc/device.properties");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/etc/device.properties")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

}

std::remove("/etc/device.properties");
std::remove("/lib/rdk/imageFlasher.sh");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/lib/rdk/imageFlasher.sh")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

@rdkcmf-jenkins
Copy link
Contributor

rdkcmf-jenkins commented Oct 30, 2025

Coverity Issue - Unchecked return value from library

Calling "remove("/etc/device.properties")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

Issue location

This issue was discovered outside the diff for this Pull Request. You can find it at:
Tests/L1Tests/tests/test_FirmwareUpdate.cpp:1956

@rdkcmf-jenkins
Copy link
Contributor

rdkcmf-jenkins commented Oct 30, 2025

Coverity Issue - Unchecked return value from library

Calling "remove("/lib/rdk/imageFlasher.sh")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

Issue location

This issue was discovered outside the diff for this Pull Request. You can find it at:
Tests/L1Tests/tests/test_FirmwareUpdate.cpp:1957


/* Test: UpdateFirmware Request Validation - MediaClient Device Type Detected */
TEST_F(FirmwareUpdateTest, UpdateFirmware_MediaClient_DeviceTypeCheck) {
system("mkdir -p /lib/rdk");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value

Calling "system" without checking return value (as is done elsewhere 3 out of 3 times).

Medium Impact, CWE-252
CHECKED_RETURN

std::ofstream script("/lib/rdk/imageFlasher.sh");
script << "#!/bin/sh\nexit 0\n";
}
chmod("/lib/rdk/imageFlasher.sh", 0755);
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "chmod("/lib/rdk/imageFlasher.sh", 493U)" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

// Wait long enough for thread to fully complete
std::this_thread::sleep_for(std::chrono::milliseconds(3000));

std::remove("/etc/device.properties");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/etc/device.properties")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

std::this_thread::sleep_for(std::chrono::milliseconds(3000));

std::remove("/etc/device.properties");
std::remove("/lib/rdk/imageFlasher.sh");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/lib/rdk/imageFlasher.sh")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

std::ofstream script("/lib/rdk/imageFlasher.sh");
script << "#!/bin/sh\nexit 0\n";
}
chmod("/lib/rdk/imageFlasher.sh", 0755);
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "chmod("/lib/rdk/imageFlasher.sh", 493U)" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN


/* Test: flashImage failure with maintenance mode true for mediaclient */
TEST_F(FirmwareUpdateTest, UpdateFirmware_FlashImage_Failure_MaintenanceMode_MediaClient) {
system("mkdir -p /lib/rdk /opt");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value

Calling "system" without checking return value (as is done elsewhere 3 out of 3 times).

Medium Impact, CWE-252
CHECKED_RETURN

std::ofstream script("/lib/rdk/imageFlasher.sh");
script << "#!/bin/sh\nexit 2\n";
}
chmod("/lib/rdk/imageFlasher.sh", 0755);
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "chmod("/lib/rdk/imageFlasher.sh", 493U)" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN


/* Test: Notification Register/Unregister around a successful update (event delivery check) */
TEST_F(FirmwareUpdateTest, Notification_ReceiveUpdateStateChange) {
system("mkdir -p /lib/rdk");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value

Calling "system" without checking return value (as is done elsewhere 3 out of 3 times).

Medium Impact, CWE-252
CHECKED_RETURN

// For non-mediaclient, file should remain after successful flash
EXPECT_EQ(0, access(TEST_FIRMWARE_PATH.c_str(), F_OK));

std::remove("/etc/device.properties");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/etc/device.properties")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

EXPECT_EQ(0, access(TEST_FIRMWARE_PATH.c_str(), F_OK));

std::remove("/etc/device.properties");
std::remove("/lib/rdk/imageFlasher.sh");
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Unchecked return value from library

Calling "remove("/lib/rdk/imageFlasher.sh")" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

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.

3 participants