Index: acl.c
===================================================================
RCS file: /usr/cvsroot/asterisk/acl.c,v
retrieving revision 1.43
diff -u -r1.43 acl.c
--- acl.c	4 May 2005 04:35:27 -0000	1.43
+++ acl.c	6 May 2005 20:41:30 -0000
@@ -405,7 +405,7 @@
 
 int ast_find_ourip(struct in_addr *ourip, struct sockaddr_in bindaddr)
 {
-	char ourhost[256];
+	char ourhost[MAXHOSTNAMELEN];
 	struct ast_hostent ahp;
 	struct hostent *hp;
 	struct in_addr saddr;
@@ -416,7 +416,7 @@
 		return 0;
 	}
 	/* try to use our hostname */
-	if (gethostname(ourhost, sizeof(ourhost))) {
+	if (gethostname(ourhost, sizeof(ourhost)-1)) {
 		ast_log(LOG_WARNING, "Unable to get hostname\n");
 	} else {
 		hp = ast_gethostbyname(ourhost, &ahp);
Index: asterisk.c
===================================================================
RCS file: /usr/cvsroot/asterisk/asterisk.c,v
retrieving revision 1.151
diff -u -r1.151 asterisk.c
--- asterisk.c	29 Apr 2005 17:24:58 -0000	1.151
+++ asterisk.c	6 May 2005 20:41:32 -0000
@@ -278,8 +278,8 @@
 	int res;
 	struct pollfd fds[2];
 	
-	if (gethostname(hostname, sizeof(hostname)))
+	if (gethostname(hostname, sizeof(hostname)-1))
 		strncpy(hostname, "<Unknown>", sizeof(hostname)-1);
 	snprintf(tmp, sizeof(tmp), "%s/%d/%s\n", hostname, ast_mainpid, ASTERISK_VERSION);
 	fdprint(con->fd, tmp);
 	for(;;) {
@@ -1693,8 +1680,8 @@
 		option_remote++;
 		option_nofork++;
 	}
-	if (gethostname(hostname, sizeof(hostname)))
+	if (gethostname(hostname, sizeof(hostname)-1))
		strncpy(hostname, "<Unknown>", sizeof(hostname)-1);
 	ast_mainpid = getpid();
 	ast_ulaw_init();
 	ast_alaw_init();
Index: logger.c
===================================================================
RCS file: /usr/cvsroot/asterisk/logger.c,v
retrieving revision 1.66
diff -u -r1.66 logger.c
--- logger.c	22 Apr 2005 13:11:34 -0000	1.66
+++ logger.c	6 May 2005 20:41:38 -0000
@@ -294,7 +294,7 @@
 	ast_mutex_lock(&loglock);
 	if ((s = ast_variable_retrieve(cfg, "general", "appendhostname"))) {
 		if(ast_true(s)) {
-			if(gethostname(hostname, sizeof(hostname))) {
+			if(gethostname(hostname, sizeof(hostname)-1)) {
 				strncpy(hostname, "unknown", sizeof(hostname)-1);
 				ast_log(LOG_WARNING, "What box has no hostname???\n");
 			}
Index: apps/app_voicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v
retrieving revision 1.209
diff -u -r1.209 app_voicemail.c
--- apps/app_voicemail.c	29 Apr 2005 17:00:33 -0000	1.209
+++ apps/app_voicemail.c	6 May 2005 20:41:48 -0000
@@ -1463,7 +1463,7 @@
 	FILE *p=NULL;
 	int pfd;
 	char date[256];
-	char host[256];
+	char host[MAXHOSTNAMELEN];
 	char who[256];
 	char bound[256];
 	char fname[256];
@@ -1491,7 +1491,7 @@
 		}
 	}
 	if (p) {
-		gethostname(host, sizeof(host));
+		gethostname(host, sizeof(host)-1);
 		if (strchr(srcemail, '@'))
 			strncpy(who, srcemail, sizeof(who)-1);
 		else {
@@ -1637,7 +1637,7 @@
 	}
 
 	if (p) {
-		gethostname(host, sizeof(host));
+		gethostname(host, sizeof(host)-1);
 		if (strchr(srcemail, '@'))
 			strncpy(who, srcemail, sizeof(who)-1);
 		else {
Index: channels/chan_mgcp.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_mgcp.c,v
retrieving revision 1.119
diff -u -r1.119 chan_mgcp.c
--- channels/chan_mgcp.c	4 May 2005 19:17:09 -0000	1.119
+++ channels/chan_mgcp.c	6 May 2005 20:41:53 -0000
@@ -248,7 +248,7 @@
 static int capability = AST_FORMAT_ULAW;
 static int nonCodecCapability = AST_RTP_DTMF;
 
-static char ourhost[256];
+static char ourhost[MAXHOSTNAMELEN];
 static struct in_addr __ourip;
 static int ourport;
 
@@ -4096,7 +4096,7 @@
 	struct hostent *hp;
 	int format;
 	
-	if (gethostname(ourhost, sizeof(ourhost))) {
+	if (gethostname(ourhost, sizeof(ourhost)-1)) {
 		ast_log(LOG_WARNING, "Unable to get hostname, MGCP disabled\n");
 		return 0;
 	}
Index: pbx/pbx_dundi.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx/pbx_dundi.c,v
retrieving revision 1.33
diff -u -r1.33 pbx_dundi.c
--- pbx/pbx_dundi.c	29 Apr 2005 17:00:33 -0000	1.33
+++ pbx/pbx_dundi.c	6 May 2005 20:42:14 -0000
@@ -4453,7 +4453,7 @@
 	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 @@
 		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));
