wtsi-npg / bambi

Process Illumina instrument data into SAM/BAM/CRAM files.
http://wtsi-npg.github.io/bambi
GNU Affero General Public License v3.0
9 stars 15 forks source link

strncpy off by one error #164

Closed mp15 closed 3 years ago

mp15 commented 4 years ago
In file included from /usr/include/string.h:494,
                 from src/array.h:25,
                 from src/bambi.h:25,
                 from src/spatial_filter.c:22:
In function ‘strncpy’,
    inlined from ‘writeFilter’ at src/spatial_filter.c:1149:2,
    inlined from ‘calculateFilter’ at src/spatial_filter.c:1571:5,
    inlined from ‘spatial_filter’ at src/spatial_filter.c:1853:26,
    inlined from ‘main_spatial_filter’ at src/spatial_filter.c:1876:21:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound 1024 equals destination size [-Werror=stringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

this relates to:

        strncpy(Fheader.cmdLine, s->argv_list, sizeof(Fheader.cmdLine));

Which is off by one because we forgot about the NULL byte at the end of the string

jenniferliddle commented 3 years ago

This has been fixed in release 0.14.0