Skip to content

Conversation

HansmannThibaut
Copy link

@HansmannThibaut HansmannThibaut commented May 1, 2022

This request find all array access that use the wrong kind of Uint. For instance,

Uint_16t i = 16;
char test[100]; 
test[i] = 100;

This query found results on Suricata. It's also part of a project to find bug or bad behaviour in Suricata.

@HansmannThibaut
Copy link
Author

Supervised by @catenacyber

@catenacyber
Copy link
Contributor

@HansmannThibaut the example you gave is missing the index used for array access ie test[i]

Copy link
Contributor

@MathiasVP MathiasVP left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution, @HansmannThibaut. Here are a couple of initial comments.

@MathiasVP
Copy link
Contributor

The code looks good now! Only a small formatting issue to fix now:

ql/cpp/ql/src/experimental/Best Practices/WrongUintAccess.ql would change by autoformatting.

Please see the Formatting section in https://github.com/github/codeql/blob/main/CONTRIBUTING.md#submitting-a-new-experimental-query.

@HansmannThibaut
Copy link
Author

Everything should be good now.

Copy link
Contributor

@MathiasVP MathiasVP left a comment

Choose a reason for hiding this comment

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

LGTM!

@MathiasVP MathiasVP merged commit 358a8ab into github:main May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants