Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misra: remove flexible array #192

Merged
merged 7 commits into from
Mar 28, 2022
Merged

Conversation

coderkalyan
Copy link
Contributor

Closes #183

@coderkalyan
Copy link
Contributor Author

As per MISRA, flexible array members should be replaced with maximum-size allocation and the following pointer arithmetic to avoid undefined behavior.

libcanard/canard.c Outdated Show resolved Hide resolved
libcanard/canard.c Outdated Show resolved Hide resolved
@@ -66,6 +66,8 @@

#define INITIAL_TOGGLE_STATE true

#define CANARD_MTU_MAX CANARD_MTU_CAN_FD
Copy link
Member

Choose a reason for hiding this comment

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

I think this actually should be in the header file (as I wrote earlier) because this is also useful for the API.

libcanard/canard.c Outdated Show resolved Hide resolved
@pavel-kirienko pavel-kirienko enabled auto-merge (squash) March 28, 2022 08:01
@pavel-kirienko pavel-kirienko merged commit d128f4e into OpenCyphal:master Mar 28, 2022
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.

Eliminate one MISRA violation by replacing flex arrays with a safer alternative
2 participants