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

Fix code scanning alert no. 13: Multiplication result converted to larger type #2675

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

lucaderi
Copy link
Member

Fixes https://github.com/ntop/nDPI/security/code-scanning/13

To fix the problem, we need to ensure that the multiplication is performed using the larger integer type (uint64_t) to avoid overflow. This can be achieved by casting one of the operands to uint64_t before performing the multiplication. This way, the multiplication will be done in the larger type, preventing overflow.

  • Cast index to uint64_t before multiplying it with filter->SegmentLength.
  • This change should be made on line 158 of the file src/lib/third_party/include/binaryfusefilter.h.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…rger type

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@lucaderi lucaderi marked this pull request as ready for review January 13, 2025 19:12
@lucaderi lucaderi merged commit 243b795 into dev Jan 13, 2025
37 checks passed
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.

1 participant