The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/2313

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Apparently -Werror=stringop-overflow will trigger an error here even though
this is completely valid since we now that we're definitely copying a \0-byte.
Work around this gcc-8 quirk by using memcpy(). This shouldn't trigger the
warning.

Signed-off-by: Christian Brauner <[email protected]>
From d3bdf12cf00e93e3b1df354dd4cc46356baedf24 Mon Sep 17 00:00:00 2001
From: Christian Brauner <[email protected]>
Date: Fri, 11 May 2018 00:16:41 +0200
Subject: [PATCH] confile: satisfy gcc-8

Apparently -Werror=stringop-overflow will trigger an error here even though
this is completely valid since we now that we're definitely copying a \0-byte.
Work around this gcc-8 quirk by using memcpy(). This shouldn't trigger the
warning.

Signed-off-by: Christian Brauner <[email protected]>
---
 src/lxc/confile_utils.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/lxc/confile_utils.c b/src/lxc/confile_utils.c
index 491b07034..fe5e078c4 100644
--- a/src/lxc/confile_utils.c
+++ b/src/lxc/confile_utils.c
@@ -621,10 +621,14 @@ bool new_hwaddr(char *hwaddr)
 
 int lxc_get_conf_str(char *retv, int inlen, const char *value)
 {
+       size_t value_len;
+
        if (!value)
                return 0;
-       if (retv && inlen >= strlen(value) + 1)
-               strncpy(retv, value, strlen(value) + 1);
+
+       value_len = strlen(value);
+       if (retv && inlen >= value_len + 1)
+               memcpy(retv, value, value_len + 1);
 
        return strlen(value);
 }
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to