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:
parent
67e3b3a8dd
commit
556d06d3bf
@ -1043,7 +1043,7 @@ static void test_netif_iter(void)
|
|||||||
|
|
||||||
static void test_netif_get_name(void)
|
static void test_netif_get_name(void)
|
||||||
{
|
{
|
||||||
char exp_name[NETIF_NAMELENMAX];
|
char exp_name[NETIF_NAMELENMAX + 1];
|
||||||
char name[NETIF_NAMELENMAX];
|
char name[NETIF_NAMELENMAX];
|
||||||
int res;
|
int res;
|
||||||
netif_t netif = netif_iter(NETIF_INVALID);
|
netif_t netif = netif_iter(NETIF_INVALID);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user