[Commits] mainwindow.c 1.274.2.352 1.274.2.353

mones at claws-mail.org mones at claws-mail.org
Thu Sep 20 00:50:46 CEST 2012


Update of /home/claws-mail/claws/src
In directory srv:/tmp/cvs-serv19306/src

Modified Files:
      Tag: gtk2
	mainwindow.c 
Log Message:
2012-09-19 [mones]	3.8.1cvs67

	* src/mainwindow.c
		Remove spurious parameter from get_url_part and
		fix potential buffer overflow 

Index: mainwindow.c
===================================================================
RCS file: /home/claws-mail/claws/src/mainwindow.c,v
retrieving revision 1.274.2.352
retrieving revision 1.274.2.353
diff -u -d -r1.274.2.352 -r1.274.2.353
--- mainwindow.c	19 Sep 2012 14:48:46 -0000	1.274.2.352
+++ mainwindow.c	19 Sep 2012 22:50:44 -0000	1.274.2.353
@@ -439,7 +439,7 @@
 
 static gint mailing_list_populate_submenu(GtkWidget *menu, const gchar * list_header);
 	
-static void get_url_part(const gchar **buf, gchar *url_decoded, gint maxlen);
+static void get_url_part(const gchar **buf, gchar *url_decoded);
 
 static void mailing_list_compose(GtkWidget *w, gpointer *data);
  
@@ -3561,7 +3561,7 @@
 	g_list_free(children);
 	if (list_header) {
 		for (url_pt = list_header; url_pt && *url_pt;) {
-			get_url_part (&url_pt, url_decoded, BUFFSIZE);
+			get_url_part (&url_pt, url_decoded);
 			item = NULL;
 			if (!g_ascii_strncasecmp(url_decoded, "mailto:", 7)) {
  				item = gtk_menu_item_new_with_label ((url_decoded));
@@ -3593,7 +3593,7 @@
 	return menu_nb;
 }
 
-static void get_url_part (const gchar **buffer, gchar *url_decoded, gint maxlen)
+static void get_url_part (const gchar **buffer, gchar *url_decoded)
 {
 	gchar tmp[BUFFSIZE];
 	const gchar *buf;
@@ -3617,7 +3617,7 @@
 		if (!strncmp(buf, "mailto:", strlen("mailto:")))
 			with_plus = FALSE;
 		for (i = 0;
-		     *buf != '>' && *buf != 0x00 && i<maxlen && i < sizeof(tmp) - 1;
+		     *buf != '>' && *buf != 0x00 && i < BUFFSIZE;
 			tmp[i++] = *(buf++));
 		buf++;
 	}
@@ -3627,13 +3627,13 @@
 		return;
 	}
 	
-	tmp[i]       = 0x00;
 	*url_decoded = '\0';
 	*buffer = NULL;
 	
-	if (i == maxlen) {
+	if (i == BUFFSIZE) {
 		return;
 	}
+	tmp[i] = 0x00;
 	decode_uri_with_plus (url_decoded, (const gchar *)tmp, with_plus);
 
 	/* Prepare the work for the next url in the list */



More information about the Commits mailing list