diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-02-10 17:58:30 +0200 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-02-10 18:39:10 +0200 |
commit | 2e24ee8d80de20e879275c087ecc1ca9b4d27297 (patch) | |
tree | da1021ed6e94fb1ae47ed561b04cde92d50ac9ba /unix | |
parent | 8c25201d9df9790f67f5a28acb0811a4e18f9161 (diff) | |
download | micropython-2e24ee8d80de20e879275c087ecc1ca9b4d27297.tar.gz micropython-2e24ee8d80de20e879275c087ecc1ca9b4d27297.zip |
socket: Tighten up int-to-str conversion.
Diffstat (limited to 'unix')
-rw-r--r-- | unix/socket.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/unix/socket.c b/unix/socket.c index 81ccf45ad5..eb4ea1e043 100644 --- a/unix/socket.c +++ b/unix/socket.c @@ -291,8 +291,8 @@ static mp_obj_t mod_socket_getaddrinfo(uint n_args, const mp_obj_t *args) { // getaddrinfo accepts port in string notation, so however // it may seem stupid, we need to convert int to str if (MP_OBJ_IS_SMALL_INT(args[1])) { - int port = MP_OBJ_SMALL_INT_VALUE(args[1]); - static char buf[20]; + int port = (short)MP_OBJ_SMALL_INT_VALUE(args[1]); + char buf[6]; sprintf(buf, "%d", port); serv = buf; } else { |