https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88993

--- Comment #6 from Richard W.M. Jones <rjones at redhat dot com> ---
I switched the warning off in libguestfs, but before it was
switched off I got all these warnings (errors in fact because
we use -Werror in development builds).

qemuopts.c: In function 'qemuopts_to_config_channel':
qemuopts.c:987:29: error: '%.*s' directive output between 0 and 2147483647
bytes may exceed minimum required size of 4095 [-Werror=format-overflow=]
  987 |             fprintf (fp, "  %.*s = ", (int) k, values[j]);
      |                             ^~~~
qemuopts.c:987:26: note: assuming directive output of 1 byte
  987 |             fprintf (fp, "  %.*s = ", (int) k, values[j]);
      |                          ^~~~~~~~~~~

utils.c: In function 'guestfs_int_full_path':
utils.c:729:27: error: '%.*s' directive output between 0 and 2147483647 bytes
may exceed minimum required size of 4095 [-Werror=format-overflow=]
  729 |     r = asprintf (&path, "%.*s", len, dir);
      |                           ^~~~
utils.c:729:26: note: assuming directive output of 1 byte
  729 |     r = asprintf (&path, "%.*s", len, dir);
      |                          ^~~~~~
utils.c:727:27: error: '%.*s' directive output between 0 and 2147483647 bytes
may exceed minimum required size of 4095 [-Werror=format-overflow=]
  727 |     r = asprintf (&path, "%.*s/%s", len, dir, name);
      |                           ^~~~
utils.c:727:26: note: assuming directive output of 1 byte
  727 |     r = asprintf (&path, "%.*s/%s", len, dir, name);
      |                          ^~~~~~~~~
utils.c:727:26: note: assuming directive output of 1 byte

In file included from info.c:43:
info.c: In function 'parse_json':
info.c:205:13: error: '%.*s' directive output between 0 and 2147483647 bytes
may exceed minimum required size of 4095 [-Werror=format-overflow=]
  205 |   debug (g, "%s: qemu-img info JSON output:\n%.*s\n", __func__, (int)
len, input);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
guestfs-internal.h:577:49: note: in definition of macro 'debug'
  577 |   do { if ((g)->verbose) guestfs_int_debug ((g),__VA_ARGS__); } while
(0)
      |                                                 ^~~~~~~~~~~
info.c:205:46: note: format string is defined here
  205 |   debug (g, "%s: qemu-img info JSON output:\n%.*s\n", __func__, (int)
len, input);
      |                                              ^~~~
In file included from info.c:43:
info.c:205:13: note: assuming directive output of 1 byte
  205 |   debug (g, "%s: qemu-img info JSON output:\n%.*s\n", __func__, (int)
len, input);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
guestfs-internal.h:577:49: note: in definition of macro 'debug'
  577 |   do { if ((g)->verbose) guestfs_int_debug ((g),__VA_ARGS__); } while
(0)
      |                                                 ^~~~~~~~~~~

btrfs.c: In function 'do_btrfs_filesystem_show':
btrfs.c:2127:27: error: '%.*s' directive output between 0 and 2147483647 bytes
may exceed minimum required size of 4095 [-Werror=format-overflow=]
 2127 |       add_sprintf (&ret, "%.*s", (int) (end - p), p);
      |                           ^~~~
btrfs.c:2127:26: note: assuming directive output of 1 byte
 2127 |       add_sprintf (&ret, "%.*s", (int) (end - p), p);
      |                          ^~~~~~

log.c: In function 'do_log':
log.c:390:17: error: '%.*s' directive output between 0 and 2147483647 bytes may
exceed minimum required size of 4095 [-Werror=format-overflow=]
  390 |       printf (" %.*s", (int) comm_len, comm);
      |                 ^~~~
log.c:390:15: note: assuming directive output of 1 byte
  390 |       printf (" %.*s", (int) comm_len, comm);
      |               ^~~~~~~
log.c:388:17: error: '%.*s' directive output between 0 and 2147483647 bytes may
exceed minimum required size of 4095 [-Werror=format-overflow=]
  388 |       printf (" %.*s", (int) identifier_len, identifier);
      |                 ^~~~
log.c:388:15: note: assuming directive output of 1 byte
  388 |       printf (" %.*s", (int) identifier_len, identifier);
      |               ^~~~~~~
log.c:394:17: error: '%.*s' directive output between 0 and 2147483647 bytes may
exceed minimum required size of 4095 [-Werror=format-overflow=]
  394 |       printf ("[%.*s]", (int) pid_len, pid);
      |                 ^~~~
log.c:394:15: note: assuming directive output of 1 byte
  394 |       printf ("[%.*s]", (int) pid_len, pid);
      |               ^~~~~~~~
log.c:404:17: error: '%.*s' directive output between 0 and 2147483647 bytes may
exceed minimum required size of 4095 [-Werror=format-overflow=]
  404 |       printf (" %.*s", (int) message_len, message);
      |                 ^~~~
log.c:404:15: note: assuming directive output of 1 byte
  404 |       printf (" %.*s", (int) message_len, message);
      |               ^~~~~~~

../common/utils/utils.c: In function 'guestfs_int_full_path':
../common/utils/utils.c:729:27: error: '%.*s' directive output between 0 and
2147483647 bytes may exceed minimum required size of 4095
[-Werror=format-overflow=]
  729 |     r = asprintf (&path, "%.*s", len, dir);
      |                           ^~~~
../common/utils/utils.c:729:26: note: assuming directive output of 1 byte
  729 |     r = asprintf (&path, "%.*s", len, dir);
      |                          ^~~~~~
../common/utils/utils.c:727:27: error: '%.*s' directive output between 0 and
2147483647 bytes may exceed minimum required size of 4095
[-Werror=format-overflow=]
  727 |     r = asprintf (&path, "%.*s/%s", len, dir, name);
      |                           ^~~~
../common/utils/utils.c:727:26: note: assuming directive output of 1 byte
  727 |     r = asprintf (&path, "%.*s/%s", len, dir, name);
      |                          ^~~~~~~~~
../common/utils/utils.c:727:26: note: assuming directive output of 1 byte

Reply via email to