Skip to content

Commit 9dc2614

Browse files
committed
C++: Make all flow source descriptions start with a lower case letter
In every context where we use the description a lower case letter makes more sense.
1 parent 7d1f10b commit 9dc2614

File tree

8 files changed

+12
-16
lines changed

8 files changed

+12
-16
lines changed

cpp/ql/lib/semmle/code/cpp/models/implementations/Fread.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ private class Fread extends AliasFunction, RemoteFlowSourceFunction {
1515

1616
override predicate hasRemoteFlowSource(FunctionOutput output, string description) {
1717
output.isParameterDeref(0) and
18-
description = "String read by " + this.getName()
18+
description = "string read by " + this.getName()
1919
}
2020
}

cpp/ql/lib/semmle/code/cpp/models/implementations/GetDelim.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ private class GetDelimFunction extends TaintFunction, AliasFunction, SideEffectF
3636

3737
override predicate hasRemoteFlowSource(FunctionOutput output, string description) {
3838
output.isParameterDeref(0) and
39-
description = "String read by " + this.getName()
39+
description = "string read by " + this.getName()
4040
}
4141
}

cpp/ql/lib/semmle/code/cpp/models/implementations/Gets.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ private class FgetsFunction extends DataFlowFunction, TaintFunction, ArrayFuncti
4949

5050
override predicate hasRemoteFlowSource(FunctionOutput output, string description) {
5151
output.isParameterDeref(0) and
52-
description = "String read by " + this.getName()
52+
description = "string read by " + this.getName()
5353
or
5454
output.isReturnValue() and
55-
description = "String read by " + this.getName()
55+
description = "string read by " + this.getName()
5656
}
5757

5858
override predicate hasArrayWithVariableSize(int bufParam, int countParam) {
@@ -98,10 +98,10 @@ private class GetsFunction extends DataFlowFunction, ArrayFunction, AliasFunctio
9898

9999
override predicate hasLocalFlowSource(FunctionOutput output, string description) {
100100
output.isParameterDeref(0) and
101-
description = "String read by " + this.getName()
101+
description = "string read by " + this.getName()
102102
or
103103
output.isReturnValue() and
104-
description = "String read by " + this.getName()
104+
description = "string read by " + this.getName()
105105
}
106106

107107
override predicate hasArrayWithUnknownSize(int bufParam) { bufParam = 0 }

cpp/ql/lib/semmle/code/cpp/models/implementations/Inet.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,6 @@ private class Getaddrinfo extends TaintFunction, ArrayFunction, RemoteFlowSource
158158

159159
override predicate hasRemoteFlowSource(FunctionOutput output, string description) {
160160
output.isParameterDeref(3) and
161-
description = "Address returned by " + this.getName()
161+
description = "address returned by " + this.getName()
162162
}
163163
}

cpp/ql/lib/semmle/code/cpp/models/implementations/Recv.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private class Recv extends AliasFunction, ArrayFunction, SideEffectFunction,
8383
or
8484
this.hasGlobalName("recvfrom") and output.isParameterDeref([4, 5])
8585
) and
86-
description = "Buffer read by " + this.getName()
86+
description = "buffer read by " + this.getName()
8787
}
8888

8989
override predicate hasSocketInput(FunctionInput input) { input.isParameter(0) }

cpp/ql/lib/semmle/code/cpp/models/implementations/Scanf.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ abstract private class ScanfFunctionModel extends ArrayFunction, TaintFunction,
7474
private class ScanfModel extends ScanfFunctionModel, LocalFlowSourceFunction instanceof Scanf {
7575
override predicate hasLocalFlowSource(FunctionOutput output, string description) {
7676
output.isParameterDeref(any(int i | i >= this.getArgsStartPosition())) and
77-
description = "Value read by " + this.getName()
77+
description = "value read by " + this.getName()
7878
}
7979
}
8080

@@ -84,7 +84,7 @@ private class ScanfModel extends ScanfFunctionModel, LocalFlowSourceFunction ins
8484
private class FscanfModel extends ScanfFunctionModel, RemoteFlowSourceFunction instanceof Fscanf {
8585
override predicate hasRemoteFlowSource(FunctionOutput output, string description) {
8686
output.isParameterDeref(any(int i | i >= this.getArgsStartPosition())) and
87-
description = "Value read by " + this.getName()
87+
description = "value read by " + this.getName()
8888
}
8989
}
9090

cpp/ql/lib/semmle/code/cpp/models/implementations/Send.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ private class Send extends AliasFunction, ArrayFunction, SideEffectFunction, Rem
5858
override ParameterIndex getParameterSizeIndex(ParameterIndex i) { i = 1 and result = 2 }
5959

6060
override predicate hasRemoteFlowSink(FunctionInput input, string description) {
61-
input.isParameterDeref(1) and description = "Buffer sent by " + this.getName()
61+
input.isParameterDeref(1) and description = "buffer sent by " + this.getName()
6262
}
6363

6464
override predicate hasSocketInput(FunctionInput input) { input.isParameter(0) }

cpp/ql/src/Security/CWE/CWE-129/ImproperArrayIndexValidation.ql

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,6 @@ class ImproperArrayIndexValidationConfig extends TaintTracking::Configuration {
116116
}
117117
}
118118

119-
/** Gets `str` where the first letter has been lowercased. */
120-
bindingset[str]
121-
string lowerFirst(string str) { result = str.prefix(1).toLowerCase() + str.suffix(1) }
122-
123119
from
124120
ImproperArrayIndexValidationConfig conf, DataFlow::PathNode source, DataFlow::PathNode sink,
125121
string sourceType
@@ -128,4 +124,4 @@ where
128124
isFlowSource(source.getNode(), sourceType)
129125
select sink.getNode(), source, sink,
130126
"An array indexing expression depends on $@ that might be outside the bounds of the array.",
131-
source.getNode(), lowerFirst(sourceType)
127+
source.getNode(), sourceType

0 commit comments

Comments
 (0)