aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2025-03-24 11:39:29 +0100
committerAndreas Schwab <schwab@suse.de>2025-03-24 15:23:32 +0100
commitc6e7d9ca72cb424b7af9357d77209eb7dd14621a (patch)
tree4867641641051ef4f745747364450f1e4be49617
parent0d998b38a6fd280973fa6e91d3e34e544eef8fb2 (diff)
downloadgcc-c6e7d9ca72cb424b7af9357d77209eb7dd14621a.zip
gcc-c6e7d9ca72cb424b7af9357d77209eb7dd14621a.tar.gz
gcc-c6e7d9ca72cb424b7af9357d77209eb7dd14621a.tar.bz2
Remove buffer overflow in cobol driver
PR cobol/119390 * gcobolspec.cc (lang_specific_driver): Use pointer instead of copying into fixed array.
-rw-r--r--gcc/cobol/gcobolspec.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/gcc/cobol/gcobolspec.cc b/gcc/cobol/gcobolspec.cc
index 364c14c..c84f405 100644
--- a/gcc/cobol/gcobolspec.cc
+++ b/gcc/cobol/gcobolspec.cc
@@ -498,15 +498,11 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
if( prior_main )
{
- char ach[128];
- if( entry_point )
- {
- strcpy(ach, entry_point);
- }
+ const char *ach;
+ if (entry_point)
+ ach = entry_point;
else
- {
- strcpy(ach, decoded_options[i].arg);
- }
+ ach = decoded_options[i].arg;
append_option(OPT_main_, ach, 1);
prior_main = false;
entry_point = NULL;