Skip to content

Conversation

@jilaypandya
Copy link
Member

This commit fixes #74761

jeppenodgaard
jeppenodgaard previously approved these changes Nov 9, 2024
Copy link

@jeppenodgaard jeppenodgaard left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

@jeppenodgaard jeppenodgaard left a comment

Choose a reason for hiding this comment

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

First check seems redundant now. Why keep it?

@jilaypandya
Copy link
Member Author

First check seems redundant now. Why keep it?

coz one of the values in the array is zero and i think in this case, no memcpy operation shall take place.

static const uint8_t fcx_mldx5_cmds_data_len[] = {
        ********************************
	[FCX_MLDX5_CMD_RESET] = 0,
        ********************************
};

@jeppenodgaard
Copy link

jeppenodgaard commented Nov 10, 2024

First check seems redundant now. Why keep it?

coz one of the values in the array is zero and i think in this case, no memcpy operation shall take place.

static const uint8_t fcx_mldx5_cmds_data_len[] = {
        **************************
	[FCX_MLDX5_CMD_RESET] = 0,
        **************************
};

Of course. Thanks for the explanation

Copy link
Member

@MaureenHelm MaureenHelm left a comment

Choose a reason for hiding this comment

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

Please explain in the commit message why you are making this change. It's ok to reference a GitHub Issue number, but that in itself isn't sufficient.

This commit fixes Copy into fixed size buffer (STRING_OVERFLOW) by checking
the cmd_data_len

Signed-off-by: Jilay Pandya <[email protected]>
@nashif nashif merged commit 6a0d735 into zephyrproject-rtos:main Nov 16, 2024
23 checks passed
@jilaypandya jilaypandya deleted the fix/issue_74761 branch November 20, 2024 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Coverity CID: 363738] Copy into fixed size buffer in drivers/sensor/fcx_mldx5/fcx_mldx5.c

5 participants