From ede1f547e72c89125b78d3fb1cf5dd7d9c68ec92 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sat, 21 Nov 2015 17:17:25 +0200 Subject: [PATCH] unix/modsocket: Use snprintf(), as defined by lib/utils/printf.c. --- unix/modsocket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unix/modsocket.c b/unix/modsocket.c index 0b0b171e5f..dad5135bfa 100644 --- a/unix/modsocket.c +++ b/unix/modsocket.c @@ -435,7 +435,7 @@ STATIC mp_obj_t mod_socket_getaddrinfo(mp_uint_t n_args, const mp_obj_t *args) { // it may seem stupid, we need to convert int to str if (MP_OBJ_IS_SMALL_INT(args[1])) { unsigned port = (unsigned short)MP_OBJ_SMALL_INT_VALUE(args[1]); - sprintf(buf, "%u", port); + snprintf(buf, sizeof(buf), "%u", port); serv = buf; hints.ai_flags = AI_NUMERICSERV; #ifdef __UCLIBC_MAJOR__