From 556d06d3bf19f358abfb0eb8e39b0cfca9007f97 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joakim=20Nohlg=C3=A5rd?= <joakim.nohlgard@eistec.se>
Date: Sat, 11 Aug 2018 07:28:11 +0200
Subject: [PATCH] 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);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
 tests/gnrc_netif/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/gnrc_netif/main.c b/tests/gnrc_netif/main.c
index 92748d8f31..12c08e60bb 100644
--- a/tests/gnrc_netif/main.c
+++ b/tests/gnrc_netif/main.c
@@ -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);
-- 
GitLab