MarvellEmbeddedProcessors / atf-marvell

BSD 3-Clause "New" or "Revised" License
24 stars 24 forks source link

Compilation of doimage.c fails with gcc version 8.2.1 #16

Open garciagorka opened 5 years ago

garciagorka commented 5 years ago

Compiling doimage.c with gcc version 8.2.1 in Linux Arch fails with the following message:

doimage.c: In function ‘main’:
doimage.c:1518:2: error: ‘strncpy’ specified bound 256 equals destination size [-Werror=stringop-truncation]
  strncpy(in_file, argv[optind], MAX_FILENAME);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
doimage.c:1523:3: error: ‘strncpy’ specified bound 256 equals destination size [-Werror=stringop-truncation]
   strncpy(out_file, argv[optind], MAX_FILENAME);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
doimage.c:1473:4: error: ‘strncpy’ specified bound 256 equals destination size [-Werror=stringop-truncation]
    strncpy(opts.bin_ext_file, optarg, MAX_FILENAME);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

This issue was solved already in ARM-software repo in this commit:

doimage: get rid of non null terminated strings by strncpy