From c1530e9406ffc61abc3566e1923493ff990421c5 Mon Sep 17 00:00:00 2001 From: Tim Cava Date: Mon, 11 Nov 2013 21:24:14 +0000 Subject: [PATCH] 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 --- source/network.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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)