From: Christian Brauner Date: Fri, 15 Jun 2018 11:36:37 +0000 (+0200) Subject: coverity: #1425855 X-Git-Tag: lxc-3.1.0~244^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a5ec15d9ee9c33a5e4b38ed77a1b1bfee9542d62;p=thirdparty%2Flxc.git coverity: #1425855 String not null terminated Signed-off-by: Christian Brauner --- diff --git a/src/lxc/tools/lxc_info.c b/src/lxc/tools/lxc_info.c index 16d60f48d..09889e31e 100644 --- a/src/lxc/tools/lxc_info.c +++ b/src/lxc/tools/lxc_info.c @@ -178,6 +178,7 @@ static void print_net_stats(struct lxc_container *c) rc = lxc_read_from_file(path, buf, sizeof(buf)); if (rc > 0) { + buf[rc - 1] = '\0'; str_chomp(buf); rx_bytes = str_size_humanize(buf, sizeof(buf)); printf("%-15s %s\n", " TX bytes:", buf); @@ -190,6 +191,7 @@ static void print_net_stats(struct lxc_container *c) rc = lxc_read_from_file(path, buf, sizeof(buf)); if (rc > 0) { + buf[rc - 1] = '\0'; str_chomp(buf); tx_bytes = str_size_humanize(buf, sizeof(buf)); printf("%-15s %s\n", " RX bytes:", buf);