Excuse me, this patch has no testsuite, either no change log.

If pass checking (get reply confirmation for this mail), I shall send
patch v2 with testsuite and change log for it, and still only cc to
gcc-patches@gcc.gnu.org.


Thanks.

On 07/28/2014 04:03 PM, Chen Gang wrote:
> External function gfc_explicit_interface_required() assumes the input
> parameter 'errmsg' will be a zero terminated string after return, and
> the input parameter 'err_len' is full length of 'errmsg'.
> 
> If 'err_len' would have real effect -- truncate 'errmsg' by strncpy()
> which will zero pad but not be sure of zero terminated, 'errmsg' would
> not be zero terminated string.
> 
> At present, it is not a bug -- all 'err_len' are large enough for it,
> But it is an extern function, according to its interface, it assumes
> 'errmsg' may be truncated in the future, so still need fix it.
> 
> 
> Signed-off-by: Chen Gang <gang.chen.5...@gmail.com>
> ---
>  gcc/fortran/resolve.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
> index 15d8dab..a109168 100644
> --- a/gcc/fortran/resolve.c
> +++ b/gcc/fortran/resolve.c
> @@ -2212,6 +2212,10 @@ gfc_explicit_interface_required (gfc_symbol *sym, char 
> *errmsg, int err_len)
>  {
>    gfc_formal_arglist *arg = gfc_sym_get_dummy_args (sym);
>  
> +  if (--err_len < 0)
> +    return false;
> +  errmsg[err_len] = '\0';
> +
>    for ( ; arg; arg = arg->next)
>      {
>        if (!arg->sym)
> 

-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed

Reply via email to