mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:08:10 +00:00
Everywhere: Fix format-vulnerabilities
Command used: grep -Pirn '(out|warn)ln\((?!["\)]|format,|stderr,|stdout,|output, ")' \ AK Kernel/ Tests/ Userland/ (Plus some manual reviewing.) Let's pick ArgsParser as an example: outln(file, m_general_help); This will fail at runtime if the general help happens to contain braces. Even if this transformation turns out to be unnecessary in a place or two, this way the code is "more obviously" correct.
This commit is contained in:
parent
7dfecbee44
commit
2e4ec891da
4 changed files with 4 additions and 4 deletions
|
@ -24,7 +24,7 @@ RefPtr<SQL::SQLResult> execute(NonnullRefPtr<SQL::Database> database, String con
|
||||||
auto statement = parser.next_statement();
|
auto statement = parser.next_statement();
|
||||||
EXPECT(!parser.has_errors());
|
EXPECT(!parser.has_errors());
|
||||||
if (parser.has_errors()) {
|
if (parser.has_errors()) {
|
||||||
outln(parser.errors()[0].to_string());
|
outln("{}", parser.errors()[0].to_string());
|
||||||
}
|
}
|
||||||
SQL::AST::ExecutionContext context { database };
|
SQL::AST::ExecutionContext context { database };
|
||||||
auto result = statement->execute(context);
|
auto result = statement->execute(context);
|
||||||
|
|
|
@ -201,7 +201,7 @@ void ArgsParser::print_usage(FILE* file, const char* argv0)
|
||||||
|
|
||||||
if (m_general_help != nullptr && m_general_help[0] != '\0') {
|
if (m_general_help != nullptr && m_general_help[0] != '\0') {
|
||||||
outln(file, "\nDescription:");
|
outln(file, "\nDescription:");
|
||||||
outln(file, m_general_help);
|
outln(file, "{}", m_general_help);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_options.is_empty())
|
if (!m_options.is_empty())
|
||||||
|
|
|
@ -110,7 +110,7 @@ int main(int argc, char** argv)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
outln(final_path);
|
outln("{}", final_path);
|
||||||
free(final_path);
|
free(final_path);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ int main()
|
||||||
sql_client->on_next_result = [&](int, Vector<String> const& row) {
|
sql_client->on_next_result = [&](int, Vector<String> const& row) {
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.join(", ", row);
|
builder.join(", ", row);
|
||||||
outln(builder.build());
|
outln("{}", builder.build());
|
||||||
};
|
};
|
||||||
|
|
||||||
sql_client->on_results_exhausted = [&](int, int total_rows) {
|
sql_client->on_results_exhausted = [&](int, int total_rows) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue