Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
15 changes: 11 additions & 4 deletions iarm_query_powerstate/IARM_Bus_CheckPowerStatus.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:

Check failure on line 3 in iarm_query_powerstate/IARM_Bus_CheckPowerStatus.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'iarm_query_powerstate/IARM_Bus_CheckPowerStatus.c' (Match: rdk/components/generic/sys_mon_tools/iarm_query_powerstate/rdk/components/generic/sys_mon_tools/iarm_query_powerstate/2.1-20161212, 80 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/sys_mon_tools/iarm_query_powerstate/+archive/2.1-20161212.tar.gz, file: IARM_Bus_CheckPowerStatus.c)
*
* Copyright 2016 RDK Management
*
Expand Down Expand Up @@ -81,7 +81,8 @@
int ret = 0;

if (argc > 1) {
if (argv[1][1] == 'c') {
// Copilot fix: Added bounds check to prevent array out-of-bounds access
if (argv[1] && strlen(argv[1]) > 1 && argv[1][1] == 'c') {
uint32_t res = 0;
PowerController_PowerState_t curState = POWER_STATE_UNKNOWN, previousState = POWER_STATE_UNKNOWN;

Expand Down Expand Up @@ -114,7 +115,7 @@
/* Dispose closes RPC conn, do not make any power manager calls after this */
PowerController_Term();

} else if (argv[1][1] == 'h') {
} else if (argv[1] && strlen(argv[1]) > 1 && argv[1][1] == 'h') {
usage();
}
} else {
Expand All @@ -126,8 +127,14 @@
memset(&pwrSettings, 0, sizeof(PWRMgr_Settings_t));

if (fd > 0) {
lseek(fd, 0, SEEK_SET);
ret = read(fd, &pwrSettings, (sizeof(PWRMgr_Settings_t) - PADDING_SIZE));
// Copilot fix: Added lseek error handling and ensured fd is closed in all paths
// to prevent resource leak
off_t seek_result = lseek(fd, 0, SEEK_SET);
if (seek_result < 0) {
printf("Error in seeking PWRMgr settings File\n");
} else {
ret = read(fd, &pwrSettings, (sizeof(PWRMgr_Settings_t) - PADDING_SIZE));
}

close(fd);
}
Expand Down
3 changes: 2 additions & 1 deletion iarm_set_powerstate/IARM_BUS_SetPowerStatus.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ typedef struct {
static void* asyncThreadMain(void* arg)
{
Controller* controller = (Controller*)arg;
usleep((controller->ack - 0.05) * 1000000); // Ack delay minus 50ms
// Copilot fix: Changed from floating-point to integer-only arithmetic to prevent overflow
usleep(controller->ack * 1000000 - 50000); // Ack delay minus 50ms
PowerController_PowerModePreChangeComplete(controller->clientId, controller->transactionId);
return NULL;
}
Expand Down
11 changes: 8 additions & 3 deletions key_simulator/IARM_BUS_UIEventSimulator.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:

Check failure on line 3 in key_simulator/IARM_BUS_UIEventSimulator.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'key_simulator/IARM_BUS_UIEventSimulator.c' (Match: rdk/components/generic/sys_mon_tools/key_simulator/rdk/components/generic/sys_mon_tools/key_simulator/c7c2639, 285 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/sys_mon_tools/key_simulator/+archive/c7c2639a97918c73e74d0241d9c0c9ab047f770a.tar.gz, file: IARM_BUS_UIEventSimulator.c)

Check failure on line 3 in key_simulator/IARM_BUS_UIEventSimulator.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'key_simulator/IARM_BUS_UIEventSimulator.c' (Match: rdk/components/generic/sys_mon_tools/key_simulator/rdk/components/generic/sys_mon_tools/key_simulator/2007, 285 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/sys_mon_tools/key_simulator/+archive/RDK-DEV-2007.tar.gz, file: IARM_BUS_UIEventSimulator.c)
*
* Copyright 2016 RDK Management
*
Expand Down Expand Up @@ -228,10 +228,15 @@
#endif

printf("Sending Key (%x, %x) from %s\r\n", keyType, keyCode, executableName);
printf("%d:%s: Using UINPUT dipatcher", __LINE__, __func__);
printf("%d:%s: Using UINPUT dispatcher", __LINE__, __func__);
uinput_dispatcher_t dispatcher = UINPUT_GetDispatcher();
/*Time being replacing scan code with 0 to run the functionality*/
dispatcher( keyCode, keyType, 0);
// Copilot fix: Added null pointer check to prevent crash when dispatcher is unavailable
if (dispatcher != NULL) {
/*Time being replacing scan code with 0 to run the functionality*/
dispatcher( keyCode, keyType, 0);
} else {
printf("%d:%s: Error: UINPUT dispatcher not available\n", __LINE__, __func__ );
}
}

/**
Expand Down
Loading