gnome-pilot-conduit buffer fixes



The latest gnome-pilot-conduit package has a couple buffer issues in the memo file conduit which were causing problems. If a long memo name was created, the .ids file was getting corrupted. The code was truncating the line at 127 characters and neglecting to place a \n in the file. I have included a diff which increases the buffer sizes.

Jeff

Index: memo_file/memo_file_conduit.c
===================================================================
RCS file: /cvs/gnome/gnome-pilot-conduits/memo_file/memo_file_conduit.c,v
retrieving revision 1.37
diff -u -r1.37 memo_file_conduit.c
--- memo_file/memo_file_conduit.c	2001/09/17 04:36:42	1.37
+++ memo_file/memo_file_conduit.c	2001/11/15 04:20:39
@@ -222,10 +222,10 @@
 	while ( rec < end && isspace (*rec) )		/* skip whitespace */
 		++rec;
 	
-	/* Go only upto 63 characters for file names. That should be enough. 
+	/* Go only upto 254 characters for file names. That should be enough. 
 	   protect_name () can maximally generate 4*n character name
 	*/
-	for ( i = 0; rec < end && i < 63; ++i, ++rec) {
+	for ( i = 0; rec < end && i < 254; ++i, ++rec) {
 		if ( *rec == '\n' )
 			break;
 		else
@@ -314,7 +314,7 @@
 spool_foreach (MemoLocalRecord *local,GnomePilotConduitStandardAbs *abs)
 {
 	int f;
-	gchar entry[128];
+	gchar entry[1024];
 	mode_t mode;
 	
 	if (!local || local->length == 0 ||
@@ -334,7 +334,7 @@
 	
 	f = open (idfile_name (local->category,abs),O_WRONLY|O_APPEND|O_CREAT,0600);
 	g_return_if_fail (f!=-1);
-	g_snprintf (entry,127,"%lu:%d:%lu;%s\n",local->local.ID,local->local.secret,time (NULL),local->filename);
+	g_snprintf (entry,1023,"%lu:%d:%lu;%s\n",local->local.ID,local->local.secret,time (NULL),local->filename);
 	write (f,entry,strlen (entry));
 	close (f);
 }
@@ -412,7 +412,7 @@
 {
 	int cnt;
 	gchar filename[FILENAME_MAX];
-	gchar entry[128];
+	gchar entry[1023];
 	int f;
 
 	g_return_if_fail (GET_CONDUIT_CFG (abs)->dir != NULL);
@@ -424,7 +424,7 @@
 	mkdir (GET_CONDUIT_CFG (abs)->dir,GET_CONDUIT_CFG (abs)->dir_mode);
 	for (cnt=0;cnt<17;cnt++) {
 		mkdir (category_path (cnt,abs),GET_CONDUIT_CFG (abs)->dir_mode);-		g_snprintf (entry,127,"%d;%s\n",cnt,category_path (cnt,abs));
+		g_snprintf (entry,1023,"%d;%s\n",cnt,category_path (cnt,abs));
 		write (f,entry,strlen (entry));
 	}
 	close (f);




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]