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

Use correct max size in strftime to avoid possible out of bounds access #1520

Merged
merged 1 commit into from
Dec 27, 2023

Conversation

MTRNord
Copy link

@MTRNord MTRNord commented Dec 25, 2023

Proposed changes

The max size in strftime is for the dt variable and not for startMsg. (See https://man7.org/linux/man-pages/man3/strftime.3.html ) This was likely just a typo. Cppcheck was throwing an error "Buffer is accessed out of bounds: dt" for this as the dt buffer is only 128 chars not 256.

Types of changes

What types of changes does your code introduce to the project: Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of
them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before
merging your code.

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • I have added tests that prove my fix is effective or that my feature works (I think those are not relevant here? But please correct me otherwise)
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

@MTRNord
Copy link
Author

MTRNord commented Dec 25, 2023

I have read the CLA Document and I hereby sign the CLA

Copy link

github-actions bot commented Dec 25, 2023

CLA Assistant Lite bot All contributors have signed the CLA ✍️

github-actions bot added a commit that referenced this pull request Dec 25, 2023
@MTRNord MTRNord changed the title Use correct max size in strftime to avoid possible out of range access Use correct max size in strftime to avoid possible out of bounds access Dec 25, 2023
Copy link
Collaborator

@kzangeli kzangeli left a comment

Choose a reason for hiding this comment

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

LGTM.
Although, sizeof(dt)would be even better :)

Thank you for the contribution!!!

@kzangeli kzangeli merged commit efe2520 into FIWARE:develop Dec 27, 2023
9 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants