mirror of
https://github.com/github/codeql.git
synced 2026-04-28 18:25:24 +02:00
CPP: Move the 'gets' case.
This commit is contained in:
@@ -18,20 +18,6 @@ abstract class PotentiallyDangerousFunctionCall extends FunctionCall {
|
||||
abstract string getDescription();
|
||||
}
|
||||
|
||||
class GetsCall extends PotentiallyDangerousFunctionCall {
|
||||
GetsCall() {
|
||||
this.getTarget().hasName("gets")
|
||||
}
|
||||
|
||||
override predicate isDangerous() {
|
||||
any()
|
||||
}
|
||||
|
||||
override string getDescription() {
|
||||
result = "gets does not guard against buffer overflow"
|
||||
}
|
||||
}
|
||||
|
||||
class SprintfCall extends PotentiallyDangerousFunctionCall {
|
||||
SprintfCall() {
|
||||
this.getTarget().hasName("sprintf") or this.getTarget().hasName("vsprintf")
|
||||
|
||||
@@ -15,6 +15,9 @@ predicate potentiallyDangerousFunction(Function f, string message) {
|
||||
(
|
||||
f.getQualifiedName() = "gmtime" and
|
||||
message = "Call to gmtime is potentially dangerous"
|
||||
) or (
|
||||
f.hasName("gets") and
|
||||
message = "gets does not guard against buffer overflow"
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user