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

Do not dereference go dependency fields without checking the length of fields first #3598

Merged
merged 1 commit into from
Jun 13, 2024

Conversation

jhrozek
Copy link
Contributor

@jhrozek jhrozek commented Jun 13, 2024

Summary

Or else malformed patches might cause us trouble.

Change Type

  • Bug fix (resolves an issue without affecting existing features)
  • Feature (adds new functionality without breaking changes)
  • Breaking change (may impact existing functionalities or require documentation updates)
  • Documentation (updates or additions to documentation)
  • Refactoring or test improvements (no bug fixes or new functionality)

Testing

added a test

Review Checklist:

  • Reviewed my own code for quality and clarity.
  • Added comments to complex or tricky code sections.
  • Updated any affected documentation.
  • Included tests that validate the fix or feature.
  • Checked that related changes are merged.

…f fields first

Or else malformed patches might cause us trouble.
@jhrozek jhrozek requested a review from a team as a code owner June 13, 2024 12:54
@coveralls
Copy link

Coverage Status

coverage: 53.352% (+0.02%) from 53.335%
when pulling 8aee05c on jhrozek:parse_crash
into d02d1b8 on stacklok:main.

@jhrozek jhrozek merged commit 5d1bd36 into mindersec:main Jun 13, 2024
22 checks passed
Comment on lines +195 to +197
if len(fields) < 5 {
return nil
}
Copy link
Member

Choose a reason for hiding this comment

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

Does this duplicate the condition on the line above (&& len(fields) >= 5)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops you're right. I fixed the condition for the require path and then didn't see the && len part and ended up just adding a redundant check. I'll send a follow-up. Thanks for noticing.

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.

5 participants