tests/gnrc_netif: Fix -Wformat-overflow

Fixes the following error with GCC 7

main.c: In function 'test_netif_get_name':
main.c:1054:23: error: 'sprintf' may write a terminating nul past the end of the destination [-Werror=format-overflow=]
     sprintf(exp_name, "if%d", (int)netif);
                       ^~~~~~
main.c:1054:5: note: 'sprintf' output between 4 and 9 bytes into a destination of size 8
     sprintf(exp_name, "if%d", (int)netif);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
Joakim Nohlgård 2018-08-11 07:28:11 +02:00
parent 67e3b3a8dd
commit 556d06d3bf

View File

@ -1043,7 +1043,7 @@ static void test_netif_iter(void)
static void test_netif_get_name(void)
{
char exp_name[NETIF_NAMELENMAX];
char exp_name[NETIF_NAMELENMAX + 1];
char name[NETIF_NAMELENMAX];
int res;
netif_t netif = netif_iter(NETIF_INVALID);