From 96f32a206b2cc6784a65a6a62addb074e4b72f45 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 5 Aug 2013 01:16:26 +0200 Subject: [PATCH] test: replace sprintf() with snprintf() There is zero risk of overflowing the buffer, it's just a good habit. --- test/test-ip6-addr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test-ip6-addr.c b/test/test-ip6-addr.c index d65043ea..9cd9b97c 100644 --- a/test/test-ip6-addr.c +++ b/test/test-ip6-addr.c @@ -76,9 +76,9 @@ void test_ip6_addr_scope(const char* ip6_addr, if (strncmp(ip6_addr, "fe80::", 6) != 0) return; #ifdef _WIN32 - sprintf(scoped_addr, "%s%%%d", ip6_addr, iface_index); + snprintf(scoped_addr, sizeof(scoped_addr), "%s%%%d", ip6_addr, iface_index); #else - sprintf(scoped_addr, "%s%%%s", ip6_addr, device_name); + snprintf(scoped_addr, sizeof(scoped_addr), "%s%%%s", ip6_addr, device_name); #endif LOGF("Testing link-local address %s (iface_index: 0x%02x, device_name: %s)\n",