strcpy will keep reading and writing memory if the string is not terminated
with null character. In this case, it may visit memory beyond the boundary.
gcc/testsuite/
2017-08-31 Renlin Li <renlin.li@arm.com>
Aaron Sawdey <acsawdey@linux.vnet.ibm.com>
* gcc.dg/memcmp-1.c (test_strncmp): Use memcpy instead of strcpy.
Co-Authored-By: Aaron Sawdey <acsawdey@linux.vnet.ibm.com>
From-SVN: r251554
+2017-08-31 Renlin Li <renlin.li@arm.com>
+ Aaron Sawdey <acsawdey@linux.vnet.ibm.com>
+
+ * gcc.dg/memcmp-1.c: Use memcpy instead of strcpy.
+
2017-08-30 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
PR tree-optimization/81987
{ \
a = three+i*ALIGN+j*(4096-2*i*ALIGN); \
b = four+i*ALIGN+j*(4096-2*i*ALIGN); \
- strcpy(a,str1); \
- strcpy(b,str2); \
+ memcpy(a,str1,SZ); \
+ memcpy(b,str2,SZ); \
r = strncmp(a,b,SZ); \
if ( r < 0 && !(expect < 0) ) abort(); \
if ( r > 0 && !(expect > 0) ) abort(); \