[PATCH] psxhdrs/strncat: Fix string truncation warning

Joel Sherrill joel at rtems.org
Thu Jul 30 12:55:22 UTC 2020


This looks OK to me. The code is never executed but it shouldn't have a
warning either.

What compiler spotted this?

Poke Sebastian or Christian to push it to 5 and master. I am not going to
be able to do that today.

On Thu, Jul 30, 2020 at 7:47 AM Aschref Ben-Thabet <
aschref.ben-thabet at embedded-brains.de> wrote:

> From: Aschref Ben Thabet <aschref.ben-thabet at embedded-brains.de>
>
> ---
>  testsuites/psxtests/psxhdrs/string/strncat.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/testsuites/psxtests/psxhdrs/string/strncat.c
> b/testsuites/psxtests/psxhdrs/string/strncat.c
> index 730a56cfa6..d872be3408 100644
> --- a/testsuites/psxtests/psxhdrs/string/strncat.c
> +++ b/testsuites/psxtests/psxhdrs/string/strncat.c
> @@ -45,7 +45,7 @@
>     char buffer[SIZE] = "computer";
>     char *result;
>
> -   result = strncat( buffer, " program", 3 );
> +   result = strncat( buffer, " program", sizeof( buffer ) - 1 );
>
>     return ( result != NULL );
>   }
> --
> 2.26.2
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200730/1f3b45ea/attachment.html>


More information about the devel mailing list