LGTM

> -----Original Message-----
> From: Andreas Schwab <sch...@suse.de>
> Sent: Monday, March 24, 2025 06:47
> To: gcc-patches@gcc.gnu.org
> Cc: jklow...@cobolworx.com; rdub...@symas.com
> Subject: [PATCH] Remove buffer overflow in cobol driver
> 
> * gcobolspec.cc (lang_specific_driver): Use pointer instead of
> copying into fixed array.
> ---
>  gcc/cobol/gcobolspec.cc | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> 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;
> --
> 2.49.0
> 
> 
> --
> Andreas Schwab, SUSE Labs, sch...@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."

Reply via email to