coverity: #1425855

String not null terminated Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent ad141c3d
...@@ -178,6 +178,7 @@ static void print_net_stats(struct lxc_container *c) ...@@ -178,6 +178,7 @@ static void print_net_stats(struct lxc_container *c)
rc = lxc_read_from_file(path, buf, sizeof(buf)); rc = lxc_read_from_file(path, buf, sizeof(buf));
if (rc > 0) { if (rc > 0) {
buf[rc - 1] = '\0';
str_chomp(buf); str_chomp(buf);
rx_bytes = str_size_humanize(buf, sizeof(buf)); rx_bytes = str_size_humanize(buf, sizeof(buf));
printf("%-15s %s\n", " TX bytes:", buf); printf("%-15s %s\n", " TX bytes:", buf);
...@@ -190,6 +191,7 @@ static void print_net_stats(struct lxc_container *c) ...@@ -190,6 +191,7 @@ static void print_net_stats(struct lxc_container *c)
rc = lxc_read_from_file(path, buf, sizeof(buf)); rc = lxc_read_from_file(path, buf, sizeof(buf));
if (rc > 0) { if (rc > 0) {
buf[rc - 1] = '\0';
str_chomp(buf); str_chomp(buf);
tx_bytes = str_size_humanize(buf, sizeof(buf)); tx_bytes = str_size_humanize(buf, sizeof(buf));
printf("%-15s %s\n", " RX bytes:", buf); printf("%-15s %s\n", " RX bytes:", buf);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment