[Asterisk-cvs] asterisk/stdtime localtime.c,1.7,1.8

markster at lists.digium.com markster at lists.digium.com
Wed Jul 14 10:11:31 CDT 2004


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

Modified Files:
	localtime.c 
Log Message:
Merge remaining audit patch (save dlfcn.c)


Index: localtime.c
===================================================================
RCS file: /usr/cvsroot/asterisk/stdtime/localtime.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- localtime.c	9 Jun 2004 01:45:08 -0000	1.7
+++ localtime.c	14 Jul 2004 13:57:15 -0000	1.8
@@ -235,7 +235,7 @@
 		** to hold the longest file name string that the implementation
 		** guarantees can be opened."
 		*/
-		char		fullname[FILENAME_MAX + 1];
+		char		fullname[FILENAME_MAX + 1] = "";
 
 		if (name[0] == ':')
 			++name;
@@ -245,9 +245,9 @@
 				return -1;
 			if ((strlen(p) + 1 + strlen(name) + 1) >= sizeof fullname)
 				return -1;
-			(void) strcpy(fullname, p);
-			(void) strcat(fullname, "/");
-			(void) strcat(fullname, name);
+			(void) strncpy(fullname, p, sizeof(fullname) - 1);
+			(void) strncat(fullname, "/", sizeof(fullname) - strlen(fullname) - 1);
+			(void) strncat(fullname, name, sizeof(fullname) - strlen(fullname) - 1);
 			/*
 			** Set doaccess if '.' (as in "../") shows up in name.
 			*/
@@ -929,7 +929,7 @@
 		cur_state->timecnt = 0;
 		cur_state->ttis[0].tt_gmtoff = 0;
 		cur_state->ttis[0].tt_abbrind = 0;
-		(void) strcpy(cur_state->chars, gmt);
+		(void) strncpy(cur_state->chars, gmt, sizeof(cur_state->chars) - 1);
 	} else if (tzload(name, cur_state) != 0) {
 		if (name[0] == ':') {
 			(void) gmtload(cur_state);
@@ -940,7 +940,7 @@
 				(void) gmtload(cur_state);
 		}
 	}
-	strncpy(cur_state->name,name,sizeof(cur_state->name));
+	strncpy(cur_state->name, name, sizeof(cur_state->name) - 1);
 	if (last_lclptr)
 		last_lclptr->next = cur_state;
 	else




More information about the svn-commits mailing list