]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Remove buffer overflow in cobol driver
authorAndreas Schwab <schwab@suse.de>
Mon, 24 Mar 2025 10:39:29 +0000 (11:39 +0100)
committerAndreas Schwab <schwab@suse.de>
Mon, 24 Mar 2025 14:23:32 +0000 (15:23 +0100)
PR cobol/119390
* gcobolspec.cc (lang_specific_driver): Use pointer instead of
copying into fixed array.

gcc/cobol/gcobolspec.cc

index 364c14c8a7004b0e652c5aaa9187313ccbfb2300..c84f4058c59d82bea65b5a623c6548dc6a12c25c 100644 (file)
@@ -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;