Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Multiple -Werror=format-overflow= errors in container.c #364

Open
@jonathonf

Description

@jonathonf

Building hyperstart 1.1.0 with GCC 8.2:

container.c: In function ‘hyper_setup_container_rootfs’:
container.c:660:24: error: ‘/’ directive writing 1 byte into a region of size between 0 and 511 [-Werror=format-overflow=]
  sprintf(rootfs, "%s/%s/", root, container->rootfs);
                        ^
In file included from /usr/include/stdio.h:873,
                 from container.c:2:
/usr/include/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output 3 or more bytes (assuming 514) into a destination of size 512
   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __bos (__s), __fmt, __va_arg_pack ());
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
container.c:282:18: error: ‘%s’ directive writing up to 511 bytes into a region of size 510 [-Werror=format-overflow=]
  sprintf(dst, "./%s", src);
                  ^~   ~~~
In file included from /usr/include/stdio.h:873,
                 from container.c:2:
/usr/include/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 3 and 514 bytes into a destination of size 512
   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __bos (__s), __fmt, __va_arg_pack ());
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
container.c:238:24: error: ‘/_data’ directive writing 6 bytes into a region of size between 1 and 512 [-Werror=format-overflow=]
     sprintf(volume, "%s/_data", path);
                        ^~~~~~
In file included from /usr/include/stdio.h:873,
                 from container.c:2:
/usr/include/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 7 and 518 bytes into a destination of size 512
   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __bos (__s), __fmt, __va_arg_pack ());
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
container.c:167:24: error: ‘/_data’ directive writing 6 bytes into a region of size between 0 and 511 [-Werror=format-overflow=]
    sprintf(volume, "/%s/_data", path);
                        ^~~~~~
In file included from /usr/include/stdio.h:873,
                 from container.c:2:
/usr/include/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 8 and 519 bytes into a destination of size 512
   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __bos (__s), __fmt, __va_arg_pack ());
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
container.c:149:24: error: ‘/’ directive writing 1 byte into a region of size between 0 and 511 [-Werror=format-overflow=]
    sprintf(volume, "/%s/", path);
                        ^
In file included from /usr/include/stdio.h:873,
                 from container.c:2:
/usr/include/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 3 and 514 bytes into a destination of size 512
   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __bos (__s), __fmt, __va_arg_pack ());
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
container.c:196:24: error: ‘/_data/’ directive writing 7 bytes into a region of size between 0 and 511 [-Werror=format-overflow=]
    sprintf(volume, "/%s/_data/%s", path, filevolume);
                        ^~~~~~~
In file included from /usr/include/stdio.h:873,
                 from container.c:2:
/usr/include/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output 9 or more bytes (assuming 520) into a destination of size 512
   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __bos (__s), __fmt, __va_arg_pack ());
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions