socket: Tighten up int-to-str conversion.

This commit is contained in:
Paul Sokolovsky 2014-02-10 17:58:30 +02:00
parent 8c25201d9d
commit 2e24ee8d80
1 changed files with 2 additions and 2 deletions

View File

@ -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 {