File tree Expand file tree Collapse file tree
cpp/ql/src/Likely Bugs/Format Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 * to a mismatch between the number of arguments defined by the 'format' and the number
55 * of arguments actually passed to the function. If the format string ultimately stems
66 * 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.
1511 * @kind problem
1612 * @problem.severity recommendation
1713 * @security-severity 9.3
You can’t perform that action at this time.
0 commit comments