Convert sprintf calls to snprintf. From pvaldes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@447 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
@@ -752,7 +752,8 @@ extern char *BX_host_to_ip (const char *host)
|
|||||||
struct hostent *hep = gethostbyname(host);
|
struct hostent *hep = gethostbyname(host);
|
||||||
static char ip[30];
|
static char ip[30];
|
||||||
|
|
||||||
return (hep ? sprintf(ip,"%u.%u.%u.%u", hep->h_addr[0] & 0xff,
|
return (hep ? snprintf(ip, sizeof ip, "%u.%u.%u.%u",
|
||||||
|
hep->h_addr[0] & 0xff,
|
||||||
hep->h_addr[1] & 0xff,
|
hep->h_addr[1] & 0xff,
|
||||||
hep->h_addr[2] & 0xff,
|
hep->h_addr[2] & 0xff,
|
||||||
hep->h_addr[3] & 0xff),
|
hep->h_addr[3] & 0xff),
|
||||||
|
|||||||
Reference in New Issue
Block a user