ADOL-C icon indicating copy to clipboard operation
ADOL-C copied to clipboard

strncpy bound depends on the length of the source

Open bradbell opened this issue 4 years ago • 0 comments

I get the following warning when I build adolc using g++ 10.2.1:

../../../../ADOL-C/src/tapedoc/tapedoc.c: In function ‘filewrite_start’:
../../../../ADOL-C/src/tapedoc/tapedoc.c:57:5: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
   57 |     strncpy(fileName, baseName, strlen(baseName));
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../ADOL-C/src/tapedoc/tapedoc.c:59:5: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
   59 |     strncpy(fileName+strlen(baseName)+num, extension, strlen(extension));
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

bradbell avatar Nov 25 '20 16:11 bradbell