diff mbox series

Remove warning in swupdate-sysrestart

Message ID 20200208135929.12230-1-sbabic@denx.de
State Accepted
Headers show
Series Remove warning in swupdate-sysrestart | expand

Commit Message

Stefano Babic Feb. 8, 2020, 1:59 p.m. UTC
Remove the following warning:

tools/swupdate-sysrestart.c:107:24: warning: ā€˜%sā€™ directive writing up to
102499 bytes into a region of size 1038 [-Wformat-overflow=]
  107 |   sprintf(url, "http://%s:8080/restart", ipaddrs[dev]);

Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 tools/swupdate-sysrestart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tools/swupdate-sysrestart.c b/tools/swupdate-sysrestart.c
index 57328e3..367291d 100644
--- a/tools/swupdate-sysrestart.c
+++ b/tools/swupdate-sysrestart.c
@@ -104,7 +104,7 @@  static void restart_system(unsigned int ndevs)
 		/* something very bad, it should never happen */
 		if (!curl_handle)
 			exit(2);
-		sprintf(url, "http://%s:8080/restart", ipaddrs[dev]);
+		snprintf(url, sizeof(url), "http://%s:8080/restart", ipaddrs[dev]);
 		if ((curl_easy_setopt(curl_handle, CURLOPT_POST, 1L) != CURLE_OK) ||
 			/* get verbose debug output please */
 			(curl_easy_setopt(curl_handle, CURLOPT_VERBOSE,