From 6c4ca834fa943ac462410ad692e85078a2af697d Mon Sep 17 00:00:00 2001 From: Aschref Ben Thabet Date: Wed, 5 Aug 2020 13:54:33 +0200 Subject: psxhdrs/strncpy/stpncpy: Fix string turncation warning Since we need to test the strncpy function, using a character array with a fixed array size in this case in place of character pointer can avoid the string turncation warning. --- testsuites/psxtests/psxhdrs/string/strncpy.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'testsuites/psxtests/psxhdrs/string/strncpy.c') diff --git a/testsuites/psxtests/psxhdrs/string/strncpy.c b/testsuites/psxtests/psxhdrs/string/strncpy.c index 50b64b3d57..e80d6f6e64 100644 --- a/testsuites/psxtests/psxhdrs/string/strncpy.c +++ b/testsuites/psxtests/psxhdrs/string/strncpy.c @@ -35,16 +35,15 @@ #endif #include - int test( void ); int test( void ) { - char *dest = "Hello"; - char *src = "World"; + char src[] = "World"; + char dest[ sizeof( src ) ]; char *result; - result = strncpy( dest, src, 3 ); + result = strncpy( dest, src, sizeof( dest ) ); return ( result != NULL ); } -- cgit v1.2.3