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

Incorrect calls to strlen in CFE_ES_TaskInit #22

Closed
jphickey opened this issue Sep 12, 2019 · 1 comment · Fixed by #30
Closed

Incorrect calls to strlen in CFE_ES_TaskInit #22

jphickey opened this issue Sep 12, 2019 · 1 comment · Fixed by #30
Assignees
Milestone

Comments

@jphickey
Copy link
Contributor

Describe the bug
The function calls strlen as:
strlen(EventBuffer-1)

To Reproduce
This is undefined behavior but probably works by accident most of the time, so long as the byte before EventBuffer is not null. This also generates a compiler warning which somehow was never noticed before in previous reviews of this code (gcc 7.4.0 with -Wall switch)

Expected behavior
It probably was meant to be:
strlen(EventBuffer)-1

System observed on:
Ubuntu 18.04 (64-bit), kernel 5.0.0-23-generic, gcc 7.4.0-1ubuntu1~18.04.1

Reporter Info
Joe Hickey

@jphickey
Copy link
Contributor Author

Note: Although the sample config does use -Wall by default, it appears GCC can only trigger this warning if also using -O2 or above, which is probably why it wasn't noticed in previous reviews/verification.

skliper added a commit that referenced this issue Sep 16, 2019
Fixes string length bug
@skliper skliper added this to the 6.7.0 milestone Sep 16, 2019
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 a pull request may close this issue.

2 participants