Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

rkt-1.30.0 with lkvm stage1: builtin-run.c:412:28: error: ‘%s’ directive output may be truncated writing up to 4095 bytes into a region of size 4091 [-Werror=format-truncation=] #3966

Open
devurandom opened this issue Dec 15, 2018 · 1 comment

Comments

@devurandom
Copy link

What did you do?

I am trying to build rkt-1.30.0 on Gentoo.

What did you expect to see?

Successful build.

What did you see instead?

builtin-run.c: In function ‘kvm_run_write_sandbox_cmd.isra.1’:
builtin-run.c:412:28: error: ‘%s’ directive output may be truncated writing up to 4095 bytes into a region of size 4091 [-Werror=format-truncation=]
   snprintf(dst, len, "/host%s", resolved_path);
                            ^~   ~~~~~~~~~~~~~
In file included from /usr/include/stdio.h:862,
                 from include/kvm/util.h:13,
                 from include/kvm/builtin-run.h:4,
                 from builtin-run.c:1:
/usr/include/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output between 6 and 4101 bytes into a destination of size 4096
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

I patched that using rkt-1.30.0-fix-lkvm-resolve-program-snprintf.patch, but afterwards ran into the next error:

virtio/net.c: In function ‘virtio_net__tap_init’:
virtio/net.c:365:47: error: argument to ‘sizeof’ in ‘strncpy’ call is the same expression as the source; did you mean to use the size of the destination? [-Werror=sizeof-pointer-memaccess]
   strncpy(ifr.ifr_name, ndev->tap_name, sizeof(ndev->tap_name));
                                               ^
virtio/net.c:377:47: error: argument to ‘sizeof’ in ‘strncpy’ call is the same expression as the source; did you mean to use the size of the destination? [-Werror=sizeof-pointer-memaccess]
   strncpy(ifr.ifr_name, ndev->tap_name, sizeof(ndev->tap_name));
                                               ^
cc1: all warnings being treated as errors
@der-eismann
Copy link

The problem is actually the Makefile of kvmtools
https://git.kernel.org/pub/scm/linux/kernel/git/will/kvmtool.git/tree/Makefile?id=fdd26ecb4bc52ac7e06455d5ea2cf5ebf7d500bc#n367

I deleted the lines with a patch.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants