From a5ec15d9ee9c33a5e4b38ed77a1b1bfee9542d62 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Fri, 15 Jun 2018 13:36:37 +0200 Subject: [PATCH] coverity: #1425855 String not null terminated Signed-off-by: Christian Brauner --- src/lxc/tools/lxc_info.c | 2 ++ 1 file changed, 2 insertions(+) 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); -- 2.47.2