Skip to content

Commit aec18e7

Browse files
committed
C++: Add mempcpy to MemcpyFunction model class.
1 parent 5aff5c3 commit aec18e7

File tree

1 file changed

+5
-2
lines changed
  • cpp/ql/src/semmle/code/cpp/models/implementations

1 file changed

+5
-2
lines changed

cpp/ql/src/semmle/code/cpp/models/implementations/Memcpy.qll

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ private class MemcpyFunction extends ArrayFunction, DataFlowFunction, SideEffect
2323
this.hasGlobalOrStdName(["memcpy", "memmove"])
2424
or
2525
// bcopy(src, dest, num)
26-
this.hasGlobalName(["bcopy", "__builtin___memcpy_chk"])
26+
// mempcpy(dest, src, num)
27+
this.hasGlobalName(["bcopy", mempcpy(), "__builtin___memcpy_chk"])
2728
}
2829

2930
/**
@@ -96,7 +97,9 @@ private class MemcpyFunction extends ArrayFunction, DataFlowFunction, SideEffect
9697
}
9798

9899
override predicate parameterIsAlwaysReturned(int index) {
99-
not this.hasGlobalName("bcopy") and
100+
not this.hasGlobalName(["bcopy", mempcpy()]) and
100101
index = getParamDest()
101102
}
102103
}
104+
105+
private string mempcpy() { result = ["mempcpy", "wmempcpy"] }

0 commit comments

Comments
 (0)