Skip to content

Commit

Permalink
Merge pull request #18660 from MathiasVP/fix-union-regression
Browse files Browse the repository at this point in the history
C++: Fix regression from #18629
  • Loading branch information
jketema authored Feb 3, 2025
2 parents 0584aee + 0e6936d commit 5e92763
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cpp/ql/lib/semmle/code/cpp/commons/Buffer.qll
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ private Class getRootType(FieldAccess fa) {
exists(VariableAccess root |
root = fa.getQualifier+() and
not exists(root.getQualifier()) and
result = root.getUnspecifiedType()
// We strip the type because the root may be a pointer. For example `p` in:
// struct S { char buffer[10]; };
// S* p = ...;
// strcpy(p->buffer, "abc");
result = root.getUnspecifiedType().stripType()
)
}

Expand Down

0 comments on commit 5e92763

Please sign in to comment.