Skip to content

Commit 2e24ee8

Browse files
committed
socket: Tighten up int-to-str conversion.
1 parent 8c25201 commit 2e24ee8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

unix/socket.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,8 @@ static mp_obj_t mod_socket_getaddrinfo(uint n_args, const mp_obj_t *args) {
291291
// getaddrinfo accepts port in string notation, so however
292292
// it may seem stupid, we need to convert int to str
293293
if (MP_OBJ_IS_SMALL_INT(args[1])) {
294-
int port = MP_OBJ_SMALL_INT_VALUE(args[1]);
295-
static char buf[20];
294+
int port = (short)MP_OBJ_SMALL_INT_VALUE(args[1]);
295+
char buf[6];
296296
sprintf(buf, "%d", port);
297297
serv = buf;
298298
} else {

0 commit comments

Comments
 (0)