Use snprintf rather than sprintf. From pvaldes.

git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@431 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
Tim Cava
2013-11-07 02:41:16 +00:00
parent 590ae4c685
commit 276fd24258
41 changed files with 623 additions and 222 deletions

View File

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