From: Andreas Schwab Date: Mon, 24 Mar 2025 10:39:29 +0000 (+0100) Subject: Remove buffer overflow in cobol driver X-Git-Tag: basepoints/gcc-16~687 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6e7d9ca72cb424b7af9357d77209eb7dd14621a;p=thirdparty%2Fgcc.git Remove buffer overflow in cobol driver PR cobol/119390 * gcobolspec.cc (lang_specific_driver): Use pointer instead of copying into fixed array. --- diff --git a/gcc/cobol/gcobolspec.cc b/gcc/cobol/gcobolspec.cc index 364c14c8a70..c84f4058c59 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;