mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 11:25:35 +00:00
Fix gethostname calls (bug #4198, with mods)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5600 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -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));
|
||||
|
Reference in New Issue
Block a user