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

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 ());
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Activity

  1. shirotech commented on Nov 22, 2018

    @shirotech

    +1 same error

    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);
                            ^
    container.c:660:2: note: 'sprintf' output 3 or more bytes (assuming 514) into a destination of size 512
      sprintf(rootfs, "%s/%s/", root, container->rootfs);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    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);
                      ^~   ~~~
    container.c:282:2: note: 'sprintf' output between 3 and 514 bytes into a destination of size 512
      sprintf(dst, "./%s", src);
      ^~~~~~~~~~~~~~~~~~~~~~~~~
    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);
                            ^~~~~~
    container.c:238:5: note: 'sprintf' output between 7 and 518 bytes into a destination of size 512
         sprintf(volume, "%s/_data", path);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    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);
                            ^~~~~~
    container.c:167:4: note: 'sprintf' output between 8 and 519 bytes into a destination of size 512
        sprintf(volume, "/%s/_data", path);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    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);
                            ^
    container.c:149:4: note: 'sprintf' output between 3 and 514 bytes into a destination of size 512
        sprintf(volume, "/%s/", path);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    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);
                            ^~~~~~~
    container.c:196:4: note: 'sprintf' output 9 or more bytes (assuming 520) into a destination of size 512
        sprintf(volume, "/%s/_data/%s", path, filevolume);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
  2. self-assigned this
    on Nov 22, 2018
  3. added 2 commits that reference this issue on Nov 26, 2018
    dabc9eb
    991922c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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