From 1edb3b9f2c98067d26a0ec47246650a09a026b23 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Tue, 15 May 2018 21:20:24 +0200 Subject: [PATCH] virt plugin: fix truncation warning MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit src/virt.c: In function ‘refresh_lists’: src/virt.c:2123:61: warning: ‘%u’ directive output may be truncated writing between 1 and 10 bytes into a region of size 5 [-Wformat-truncation=] snprintf(number_string, sizeof(number_string), "interface-%u", number); ^~ src/virt.c:2123:50: note: directive argument in the range [1, 2147483647] snprintf(number_string, sizeof(number_string), "interface-%u", number); ^~~~~~~~~~~~~~ src/virt.c:2123:3: note: ‘snprintf’ output between 12 and 21 bytes into a destination of size 15 snprintf(number_string, sizeof(number_string), "interface-%u", number); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- src/virt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/virt.c b/src/virt.c index 12008f82..e97fd847 100644 --- a/src/virt.c +++ b/src/virt.c @@ -2105,7 +2105,7 @@ static int add_interface_device(struct lv_read_state *state, virDomainPtr dom, struct interface_device *new_ptr; int new_size = sizeof(state->interface_devices[0]) * (state->nr_interface_devices + 1); - char *path_copy, *address_copy, number_string[15]; + char *path_copy, *address_copy, number_string[21]; if ((path == NULL) || (address == NULL)) return EINVAL; -- 2.11.0