inet_ntop: Was printing negative values for fields >127.

This commit is contained in:
Gregory Nutt 2017-08-11 14:11:48 -06:00
parent ae33247f47
commit fdca465da6

View File

@ -100,7 +100,7 @@
#if defined(CONFIG_NET_IPv4) || defined(CONFIG_LIBC_IPv4_ADDRCONV)
static int inet_ipv4_ntop(FAR const void *src, FAR char *dest, socklen_t size)
{
FAR char *ptr;
FAR uint8_t *ptr;
if (size < INET_ADDRSTRLEN)
{
@ -108,7 +108,7 @@ static int inet_ipv4_ntop(FAR const void *src, FAR char *dest, socklen_t size)
}
ptr = (FAR char *)src;
sprintf(dest, "%d.%d.%d.%d", ptr[0], ptr[1], ptr[2], ptr[3]);
sprintf(dest, "%u.%u.%u.%u", ptr[0], ptr[1], ptr[2], ptr[3]);
return OK;
}
#endif