2020-09-12 04:20:14 +02:00
|
|
|
GCC with `-Wformat-security -Werror=format-security` hardening options enabled
|
|
|
|
by default rejects some codes in libcpp. This patch fixes them.
|
|
|
|
|
2023-02-23 16:23:48 +01:00
|
|
|
--- gcc-8.3.0/libcpp/expr.cc.bak 2020-09-11 15:44:45.770000000 +0900
|
|
|
|
+++ gcc-8.3.0/libcpp/expr.cc 2020-09-11 15:46:22.370000000 +0900
|
2020-09-12 04:20:14 +02:00
|
|
|
@@ -794,10 +794,10 @@
|
2021-05-10 23:39:45 +02:00
|
|
|
|
2020-09-12 04:20:14 +02:00
|
|
|
if (CPP_OPTION (pfile, c99))
|
|
|
|
cpp_warning_with_line (pfile, CPP_W_LONG_LONG, virtual_location,
|
|
|
|
- 0, message);
|
|
|
|
+ 0, "%s", message);
|
|
|
|
else
|
|
|
|
cpp_pedwarning_with_line (pfile, CPP_W_LONG_LONG,
|
|
|
|
- virtual_location, 0, message);
|
|
|
|
+ virtual_location, 0, "%s", message);
|
|
|
|
}
|
2021-05-10 23:39:45 +02:00
|
|
|
|
2020-09-12 04:20:14 +02:00
|
|
|
result |= CPP_N_INTEGER;
|
2023-02-23 16:23:48 +01:00
|
|
|
--- gcc-8.3.0/libcpp/macro.cc.bak 2020-09-11 16:01:42.550000000 +0900
|
|
|
|
+++ gcc-8.3.0/libcpp/macro.cc 2020-09-11 16:03:47.850000000 +0900
|
2020-09-12 04:20:14 +02:00
|
|
|
@@ -160,7 +160,7 @@
|
|
|
|
if (m_state == 2 && token->type == CPP_PASTE)
|
|
|
|
{
|
|
|
|
cpp_error_at (m_pfile, CPP_DL_ERROR, token->src_loc,
|
|
|
|
- vaopt_paste_error);
|
|
|
|
+ "%s", vaopt_paste_error);
|
|
|
|
return ERROR;
|
|
|
|
}
|
|
|
|
/* Advance states before further considering this token, in
|
|
|
|
@@ -189,7 +189,7 @@
|
|
|
|
if (was_paste)
|
|
|
|
{
|
|
|
|
cpp_error_at (m_pfile, CPP_DL_ERROR, token->src_loc,
|
|
|
|
- vaopt_paste_error);
|
|
|
|
+ "%s", vaopt_paste_error);
|
|
|
|
return ERROR;
|
|
|
|
}
|
2021-05-10 23:39:45 +02:00
|
|
|
|
2020-09-12 04:20:14 +02:00
|
|
|
@@ -3361,7 +3361,7 @@
|
|
|
|
function-like macros, but not at the end. */
|
|
|
|
if (following_paste_op)
|
|
|
|
{
|
|
|
|
- cpp_error (pfile, CPP_DL_ERROR, paste_op_error_msg);
|
|
|
|
+ cpp_error (pfile, CPP_DL_ERROR, "%s", paste_op_error_msg);
|
2021-05-10 23:39:45 +02:00
|
|
|
goto out;
|
2020-09-12 04:20:14 +02:00
|
|
|
}
|
2021-05-10 23:39:45 +02:00
|
|
|
if (!vaopt_tracker.completed ())
|
2020-09-12 04:20:14 +02:00
|
|
|
@@ -3374,7 +3374,7 @@
|
|
|
|
function-like macros, but not at the beginning. */
|
|
|
|
if (macro->count == 1)
|
|
|
|
{
|
|
|
|
- cpp_error (pfile, CPP_DL_ERROR, paste_op_error_msg);
|
|
|
|
+ cpp_error (pfile, CPP_DL_ERROR, "%s", paste_op_error_msg);
|
2021-05-10 23:39:45 +02:00
|
|
|
goto out;
|
2020-09-12 04:20:14 +02:00
|
|
|
}
|
2021-05-10 23:39:45 +02:00
|
|
|
|