freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compiler warnings when building utilities in ft2demos


From: David Turner
Subject: Re: Compiler warnings when building utilities in ft2demos
Date: Thu, 30 Apr 2020 01:18:01 +0200

Thank you, filed as https://savannah.nongnu.org/bugs/index.php?58275 now

Le mer. 29 avr. 2020 à 18:18, WILSON, MICHAEL <address@hidden> a écrit :

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

[Prev in Thread] Current Thread [Next in Thread]