Project

General

Profile

Actions

Bug #2496

closed

gcc 8 warnings

Added by Victor Julien over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Affected Versions:
Effort:
Difficulty:
Label:

Description

Tested on Fedora 28 beta.

  CC       app-layer-dcerpc.o
app-layer-dcerpc.c: In function 'hexdump':
app-layer-dcerpc.c:102:48: warning: '%.4lx' directive output may be truncated writing between 4 and 16 bytes into a region of size 10 [-Wformat-truncation=]
             snprintf(addrstr, sizeof(addrstr), "%.4"PRIx64,
                                                ^~~~~
app-layer-dcerpc.c:102:49: note: format string is defined here
             snprintf(addrstr, sizeof(addrstr), "%.4"PRIx64,
app-layer-dcerpc.c:102:48: note: directive argument in the range [0, 18446744073709551614]
             snprintf(addrstr, sizeof(addrstr), "%.4"PRIx64,
                                                ^~~~~
app-layer-dcerpc.c:102:13: note: 'snprintf' output between 5 and 17 bytes into a destination of size 10
             snprintf(addrstr, sizeof(addrstr), "%.4"PRIx64,
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             ((uint64_t)p-(uint64_t)buf) );
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  CC       log-filestore.o
log-filestore.c: In function 'LogFilestoreLogger':
log-filestore.c:422:55: warning: '/file' directive output may be truncated writing 5 bytes into a region of size between 1 and 4096 [-Wformat-truncation=]
     snprintf(base_filename, sizeof(base_filename), "%s/file%s.%u",
                                                       ^~~~~
log-filestore.c:422:5: note: 'snprintf' output between 8 and 8207 bytes into a destination of size 4096
     snprintf(base_filename, sizeof(base_filename), "%s/file%s.%u",
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             g_logfile_base_dir, pid_expression, ff->file_store_id);
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
log-filestore.c:424:45: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size between 1 and 4096 [-Wformat-truncation=]
     snprintf(filename, sizeof(filename), "%s%s", base_filename,
                                             ^~
             g_working_file_suffix);
             ~~~~~~~~~~~~~~~~~~~~~            
log-filestore.c:424:5: note: 'snprintf' output between 1 and 8191 bytes into a destination of size 4096
     snprintf(filename, sizeof(filename), "%s%s", base_filename,
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             g_working_file_suffix);
             ~~~~~~~~~~~~~~~~~~~~~~
log-filestore.c:224:53: warning: '.meta' directive output may be truncated writing 5 bytes into a region of size between 1 and 4096 [-Wformat-truncation=]
     snprintf(metafilename, sizeof(metafilename), "%s.meta%s", base_filename,
                                                     ^~~~~
log-filestore.c:224:5: note: 'snprintf' output between 6 and 8196 bytes into a destination of size 4096
     snprintf(metafilename, sizeof(metafilename), "%s.meta%s", base_filename,
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             g_working_file_suffix);
             ~~~~~~~~~~~~~~~~~~~~~~
log-filestore.c:368:57: warning: '/file' directive output may be truncated writing 5 bytes into a region of size between 1 and 4096 [-Wformat-truncation=]
     snprintf(final_filename, sizeof(final_filename), "%s/file%s.%u",
                                                         ^~~~~
log-filestore.c:368:5: note: 'snprintf' output between 8 and 8207 bytes into a destination of size 4096
     snprintf(final_filename, sizeof(final_filename), "%s/file%s.%u",
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             g_logfile_base_dir, pid_expression, ff->file_store_id);
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
log-filestore.c:371:61: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size between 1 and 4096 [-Wformat-truncation=]
     snprintf(working_filename, sizeof(working_filename), "%s%s",
                                                             ^~
             final_filename, g_working_file_suffix);
                             ~~~~~~~~~~~~~~~~~~~~~            
log-filestore.c:371:5: note: 'snprintf' output between 1 and 8191 bytes into a destination of size 4096
     snprintf(working_filename, sizeof(working_filename), "%s%s",
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             final_filename, g_working_file_suffix);
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
log-filestore.c:300:57: warning: '/file' directive output may be truncated writing 5 bytes into a region of size between 1 and 4096 [-Wformat-truncation=]
     snprintf(final_filename, sizeof(final_filename), "%s/file%s.%u",
                                                         ^~~~~
log-filestore.c:300:5: note: 'snprintf' output between 8 and 8207 bytes into a destination of size 4096
     snprintf(final_filename, sizeof(final_filename), "%s/file%s.%u",
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             g_logfile_base_dir, pid_expression, ff->file_store_id);
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
log-filestore.c:304:16: warning: '.meta' directive output may be truncated writing 5 bytes into a region of size between 1 and 4096 [-Wformat-truncation=]
             "%s.meta", final_filename);
                ^~~~~
log-filestore.c:303:5: note: 'snprintf' output between 6 and 4101 bytes into a destination of size 4096
     snprintf(final_metafilename, sizeof(final_metafilename),
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             "%s.meta", final_filename);
             ~~~~~~~~~~~~~~~~~~~~~~~~~~
log-filestore.c:307:16: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size between 1 and 4096 [-Wformat-truncation=]
             "%s%s", final_metafilename, g_working_file_suffix);
                ^~                       ~~~~~~~~~~~~~~~~~~~~~
log-filestore.c:306:5: note: 'snprintf' output between 1 and 8191 bytes into a destination of size 4096
     snprintf(working_metafilename, sizeof(working_metafilename),
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             "%s%s", final_metafilename, g_working_file_suffix);
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
log-filestore.c:382:20: warning: '.meta' directive output may be truncated writing 5 bytes into a region of size between 1 and 4096 [-Wformat-truncation=]
                 "%s.meta", final_filename);
                    ^~~~~
log-filestore.c:381:9: note: 'snprintf' output between 6 and 4101 bytes into a destination of size 4096
         snprintf(final_metafilename, sizeof(final_metafilename),
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                 "%s.meta", final_filename);
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~
log-filestore.c:385:20: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size between 1 and 4096 [-Wformat-truncation=]
                 "%s%s", final_metafilename, g_working_file_suffix);
                    ^~                       ~~~~~~~~~~~~~~~~~~~~~
log-filestore.c:384:9: note: 'snprintf' output between 1 and 8191 bytes into a destination of size 4096
         snprintf(working_metafilename, sizeof(working_metafilename),
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                 "%s%s", final_metafilename, g_working_file_suffix);
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  CC       log-pcap.o
log-pcap.c: In function 'PcapLogOpenFileCtx':
log-pcap.c:1252:48: warning: '.' directive output may be truncated writing 1 byte into a region of size between 0 and 4095 [-Wformat-truncation=]
             snprintf(filename, PATH_MAX, "%s/%s.%" PRIu32 ".%" PRIu32,
                                                ^
log-pcap.c:1252:42: note: using the range [0, 4294967295] for directive argument
             snprintf(filename, PATH_MAX, "%s/%s.%" PRIu32 ".%" PRIu32,
                                          ^~~~~~~~~
log-pcap.c:1252:42: note: using the range [0, 4294967295] for directive argument
log-pcap.c:1252:13: note: 'snprintf' output 6 or more bytes (assuming 4101) into a destination of size 4096
             snprintf(filename, PATH_MAX, "%s/%s.%" PRIu32 ".%" PRIu32,
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      dirfull, pl->prefix, (uint32_t)ts.tv_sec, (uint32_t)ts.tv_usec);
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
log-pcap.c:1249:48: warning: '.' directive output may be truncated writing 1 byte into a region of size between 0 and 4095 [-Wformat-truncation=]
             snprintf(filename, PATH_MAX, "%s/%s.%" PRIu32, dirfull,
                                                ^
log-pcap.c:1249:42: note: using the range [0, 4294967295] for directive argument
             snprintf(filename, PATH_MAX, "%s/%s.%" PRIu32, dirfull,
                                          ^~~~~~~~~
log-pcap.c:1249:13: note: 'snprintf' output 4 or more bytes (assuming 4099) into a destination of size 4096
             snprintf(filename, PATH_MAX, "%s/%s.%" PRIu32, dirfull,
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      pl->prefix, (uint32_t)ts.tv_sec);
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
log-pcap.c: In function 'PcapLogDataInit.part.7':
log-pcap.c:621:41: warning: '/' directive output may be truncated writing 1 byte into a region of size between 0 and 4095 [-Wformat-truncation=]
         snprintf(path, PATH_MAX - 1, "%s/%s", pattern, entry->d_name);
                                         ^
log-pcap.c:621:9: note: 'snprintf' output between 2 and 4352 bytes into a destination of size 4095
         snprintf(path, PATH_MAX - 1, "%s/%s", pattern, entry->d_name);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  CC       log-tlsstore.o
log-tlsstore.c: In function 'LogTlsLogPem.isra.3':
log-tlsstore.c:86:40: warning: '/' directive output may be truncated writing 1 byte into a region of size between 0 and 4095 [-Wformat-truncation=]
     snprintf(filename, filenamelen, "%s/%ld.%ld-%d.pem",
                                        ^
log-tlsstore.c:86:37: note: using the range [-2147483648, 2147483647] for directive argument
     snprintf(filename, filenamelen, "%s/%ld.%ld-%d.pem",
                                     ^~~~~~~~~~~~~~~~~~~
log-tlsstore.c:86:5: note: 'snprintf' output between 11 and 4154 bytes into a destination of size 4095
     snprintf(filename, filenamelen, "%s/%ld.%ld-%d.pem",
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              tls_logfile_base_dir,
              ~~~~~~~~~~~~~~~~~~~~~
              (long int)p->ts.tv_sec,
              ~~~~~~~~~~~~~~~~~~~~~~~
              (long int)p->ts.tv_usec,
              ~~~~~~~~~~~~~~~~~~~~~~~~
              file_id);
              ~~~~~~~~

  CC       util-runmodes.o
util-runmodes.c: In function 'RunmodeAutoFpCreatePickupQueuesString':
util-runmodes.c:78:49: warning: 'snprintf' output may be truncated before the last format character [-Wformat-truncation=]
         snprintf(qname, sizeof(qname), "pickup%d", thread+1);
                                                 ^
util-runmodes.c:78:9: note: 'snprintf' output between 8 and 17 bytes into a destination of size 16
         snprintf(qname, sizeof(qname), "pickup%d", thread+1);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Actions

Also available in: Atom PDF