File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed
cpp/ql/src/Likely Bugs/Format Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change 4
4
* to a mismatch between the number of arguments defined by the 'format' and the number
5
5
* of arguments actually passed to the function. If the format string ultimately stems
6
6
* from an untrusted source, this can be used for exploits.
7
- * This query finds all sources leading to a format string that cannot be verified to be literal.
8
- * Even if the format string type is `const char*` it is still considered non-constant if the
9
- * value is not a string literal. For example, a parameter to a function that is never observed to be called
10
- * that takes in a `const char*` and uses it as a format string, there is no way to verify the originating
11
- * value was a string literal. This is especially problematic with conversion of c strings to char *,
12
- * via `c_str()`, which returns a `const char*`, regardless if the original string was a string literal or not.
13
- * The query does not consider uninitialized variables as non-constant sources. Uninitialized
14
- * variables are a separate vulnerability concern and should be addressed by a separate query.
7
+ * This query finds format strings coming from non-literal sources. Note that format strings of
8
+ * type `const char*` it is still considered non-constant if the value is not coming from a string
9
+ * literal. For example, for a parameter with type `const char*` of an exported function that is
10
+ * used as a format string, there is no way to ensure the originating value was a string literal.
15
11
* @kind problem
16
12
* @problem.severity recommendation
17
13
* @security-severity 9.3
You can’t perform that action at this time.
0 commit comments