Skip to content

ihsinme: CPP Add query for CWE-1126: Declaration of Variable with Unnecessarily Wide Scope #364

@ihsinme

Description

@ihsinme

Query

Relevant PR: github/codeql#5767

Report

the query finds the places where the variable is declared in the body of the loop. in situations where a similar variable is already used in a condition. my analysis showed that such coding methods are often used in various projects. however, these places do not always affect safety, the simplest example is the for loop.
therefore, I have as much as possible limited the request to identify situations that have a real impact on safety.

https://wiki.sei.cmu.edu/confluence/display/c/DCL01-C.+Do+not+reuse+variable+names+in+subscopes

  • Are you planning to discuss this vulnerability submission publicly? (Blog Post, social networks, etc). We would love to have you spread the word about the good work you are doing

Result(s)

sleuthkit/sleuthkit#2329
https://github.com/RediSearch/RediSearch/blob/efe031ea498ca4299064027641fad3b8f262ef6a/src/rmutil/util.c#L66

Metadata

Metadata

Assignees

No one assigned

    Labels

    All For OneSubmissions to the All for One, One for All bounty

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions