From 00bcbaaa050472058d1a26295fb3741f2b467e38 Mon Sep 17 00:00:00 2001 From: Mark Spencer Date: Sun, 8 May 2005 16:44:25 +0000 Subject: Fix gethostname calls (bug #4198, with mods) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5600 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- pbx/pbx_dundi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pbx/pbx_dundi.c') diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c index ca3c4441a..323449da0 100755 --- a/pbx/pbx_dundi.c +++ b/pbx/pbx_dundi.c @@ -4453,7 +4453,7 @@ static int set_config(char *config_file, struct sockaddr_in* sin) char *cat; int format; int x; - char hn[256]; + char hn[MAXHOSTNAMELEN]=""; struct ast_hostent he; struct hostent *hp; struct sockaddr_in sin2; @@ -4470,7 +4470,7 @@ static int set_config(char *config_file, struct sockaddr_in* sin) return -1; } ipaddr[0] = '\0'; - if (!gethostname(hn, sizeof(hn))) { + if (!gethostname(hn, sizeof(hn)-1)) { hp = ast_gethostbyname(hn, &he); if (hp) { memcpy(&sin2.sin_addr, hp->h_addr, sizeof(sin2.sin_addr)); -- cgit v1.2.3