diff --git a/source/network.c b/source/network.c index cad3093..706bfa9 100644 --- a/source/network.c +++ b/source/network.c @@ -752,11 +752,12 @@ extern char *BX_host_to_ip (const char *host) struct hostent *hep = gethostbyname(host); static char ip[30]; - return (hep ? sprintf(ip,"%u.%u.%u.%u", hep->h_addr[0] & 0xff, - hep->h_addr[1] & 0xff, - hep->h_addr[2] & 0xff, - hep->h_addr[3] & 0xff), - ip : empty_string); + return (hep ? snprintf(ip, sizeof ip, "%u.%u.%u.%u", + hep->h_addr[0] & 0xff, + hep->h_addr[1] & 0xff, + hep->h_addr[2] & 0xff, + hep->h_addr[3] & 0xff), + ip : empty_string); } extern char *BX_ip_to_host (const char *ip)