[Asterisk-cvs] asterisk/apps app_voicemail.c,1.151.2.16,1.151.2.17

russell at lists.digium.com russell at lists.digium.com
Sun May 15 11:50:04 CDT 2005


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv16483/apps

Modified Files:
      Tag: v1-0
	app_voicemail.c 
Log Message:
ensure that calls to gethostbyname are null terminated,
also use MAXHOSTNAMELEN where appropriate (bug #4198) (bug #4212)


Index: app_voicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v
retrieving revision 1.151.2.16
retrieving revision 1.151.2.17
diff -u -d -r1.151.2.16 -r1.151.2.17
--- app_voicemail.c	2 Mar 2005 22:24:02 -0000	1.151.2.16
+++ app_voicemail.c	15 May 2005 15:55:30 -0000	1.151.2.17
@@ -862,7 +862,7 @@
 	FILE *p=NULL;
 	int pfd;
 	char date[256];
-	char host[256];
+	char host[MAXHOSTNAMELEN] = "";
 	char who[256];
 	char bound[256];
 	char fname[256];
@@ -890,7 +890,7 @@
 		}
 	}
 	if (p) {
-		gethostname(host, sizeof(host));
+		gethostname(host, sizeof(host)-1);
 		if (strchr(srcemail, '@'))
 			strncpy(who, srcemail, sizeof(who)-1);
 		else {
@@ -1020,7 +1020,7 @@
 	FILE *p=NULL;
 	int pfd;
 	char date[256];
-	char host[256];
+	char host[MAXHOSTNAMELEN]="";
 	char who[256];
 	char dur[256];
 	char tmp[80] = "/tmp/astmail-XXXXXX";
@@ -1039,7 +1039,7 @@
 	}
 
 	if (p) {
-		gethostname(host, sizeof(host));
+		gethostname(host, sizeof(host)-1);
 		if (strchr(srcemail, '@'))
 			strncpy(who, srcemail, sizeof(who)-1);
 		else {




More information about the svn-commits mailing list