Skip to content

Commit c4737c7

Browse files
committed
Changing from hasIntermediateType to getABaseType.
1 parent 338ab96 commit c4737c7

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

cpp/ql/src/Security/CWE/CWE-704/WcharCharConversion.ql

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ class WideCharPointerType extends PointerType {
2020
}
2121

2222
/**
23-
* Given type `cur`, recurses through all intermediate types to find
24-
* any intermediate type equal to type `targ`
23+
* Given type `t`, recurses through and returns all
24+
* intermediate base types, including `t`.
2525
*/
26-
predicate hasIntermediateType(Type cur, Type targ) {
27-
cur = targ
26+
Type getABaseType(Type t) {
27+
result = t
2828
or
29-
hasIntermediateType(cur.(DerivedType).getBaseType(), targ)
29+
result = getABaseType(t.(DerivedType).getBaseType())
3030
or
31-
hasIntermediateType(cur.(TypedefType).getBaseType(), targ)
31+
result = getABaseType(t.(TypedefType).getBaseType())
3232
}
3333

3434
/**
@@ -40,7 +40,7 @@ class UnlikelyToBeAStringType extends Type {
4040
targ.(CharType).isUnsigned() or
4141
targ.getName().toLowerCase().matches(["uint8_t", "%byte%"])
4242
|
43-
hasIntermediateType(this, targ)
43+
getABaseType(this) = targ
4444
)
4545
}
4646
}
@@ -59,7 +59,7 @@ class UnicodeMacroDependentWidthType extends Type {
5959
"TCHAR"
6060
]
6161
|
62-
hasIntermediateType(this, targ)
62+
getABaseType(this) = targ
6363
)
6464
}
6565
}

0 commit comments

Comments
 (0)