Good afternoon,

When building FreeType, GCC is warning of strncpy() calls which are not nul 
terminated.
Probably not a big problem in view of the context.

Example :

src/ftchkwd.c:172:9: warning: 'strncpy' output truncated before terminating nul
copying 4 bytes from a string of the same length [-Wstringop-truncation]
         strncpy( filename + strlen( filename ), ".ttf", 4 );
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/ftchkwd.c:173:9: warning: 'strncpy' output truncated before terminating nul
copying 4 bytes from a string of the same length [-Wstringop-truncation]
         strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 );
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

There are 8 source files using the same code sequence to append ".ttf" or 
".ttc" to filenames.
Two of them (ftdump.c, ftlint.c) will copy the nul (5th byte).
Six do not (compos.c, ftchkwd.c, ftmemchk.c, ftsbit.c, fttimer.c, fttry.c).


# grepall '\.ttf' | grep 'strncpy.*4'
./ft2demos-2.10.1/src/compos.c:102:        strncpy( filename + strlen( filename 
), ".ttf", 4 );
./ft2demos-2.10.1/src/ftchkwd.c:172:        strncpy( filename + strlen( 
filename ), ".ttf", 4 );
./ft2demos-2.10.1/src/ftmemchk.c:273:        strncpy( filename + strlen( 
filename ), ".ttf", 4 );
./ft2demos-2.10.1/src/ftsbit.c:206:      strncpy( filename + strlen( filename 
), ".ttf", 4 );
./ft2demos-2.10.1/src/fttimer.c:233:      strncpy( filename + strlen( filename 
), ".ttf", 4 );
./ft2demos-2.10.1/src/fttry.c:119:        strncpy( filename + strlen( filename 
), ".ttf", 4 );


Thanks.

Mike Wilson

Reply via email to