File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
cpp/ql/src/semmle/code/cpp/models/implementations Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ private class MallocAllocationFunction extends AllocationFunction {
1515
1616 MallocAllocationFunction ( ) {
1717 // --- C library allocation
18- hasGlobalOrStdName ( "malloc" ) and // malloc(size)
18+ hasGlobalOrStdOrBslName ( "malloc" ) and // malloc(size)
1919 sizeArg = 0
2020 or
2121 hasGlobalName ( [
@@ -104,7 +104,7 @@ private class CallocAllocationFunction extends AllocationFunction {
104104
105105 CallocAllocationFunction ( ) {
106106 // --- C library allocation
107- hasGlobalOrStdName ( "calloc" ) and // calloc(num, size)
107+ hasGlobalOrStdOrBslName ( "calloc" ) and // calloc(num, size)
108108 sizeArg = 1 and
109109 multArg = 0
110110 }
@@ -124,7 +124,7 @@ private class ReallocAllocationFunction extends AllocationFunction {
124124
125125 ReallocAllocationFunction ( ) {
126126 // --- C library allocation
127- hasGlobalOrStdName ( "realloc" ) and // realloc(ptr, size)
127+ hasGlobalOrStdOrBslName ( "realloc" ) and // realloc(ptr, size)
128128 sizeArg = 1 and
129129 reallocArg = 0
130130 or
Original file line number Diff line number Diff line change @@ -13,9 +13,13 @@ private class StandardDeallocationFunction extends DeallocationFunction {
1313 int freedArg ;
1414
1515 StandardDeallocationFunction ( ) {
16- hasGlobalName ( [
16+ hasGlobalOrStdOrBslName ( [
1717 // --- C library allocation
18- "free" , "realloc" ,
18+ "free" , "realloc"
19+ ] ) and
20+ freedArg = 0
21+ or
22+ hasGlobalName ( [
1923 // --- OpenSSL memory allocation
2024 "CRYPTO_free" , "CRYPTO_secure_free"
2125 ] ) and
You can’t perform that action at this time.
0 commit comments