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. 7: Multiplication result converted to larger type #2677

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

lucaderi
Copy link
Member

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

To fix the problem, we need to ensure that the multiplication is performed using the larger integer type (u_int64_t) to avoid overflow. This can be achieved by casting one of the operands to u_int64_t before performing the multiplication. Specifically, we can cast i to u_int64_t before multiplying it with the result of rand().

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

…ger 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:13
@lucaderi lucaderi merged commit 6b686be 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