SF.net SVN: geany: [695] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Fri Aug 11 17:19:57 UTC 2006


Revision: 695
Author:   eht16
Date:     2006-08-11 10:19:16 -0700 (Fri, 11 Aug 2006)
ViewCVS:  http://svn.sourceforge.net/geany/?rev=695&view=rev

Log Message:
-----------
Fixed possible segfault when replacing tabs by spaces.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/document.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-08-10 17:04:29 UTC (rev 694)
+++ trunk/ChangeLog	2006-08-11 17:19:16 UTC (rev 695)
@@ -1,3 +1,10 @@
+2006-08-11  Enrico Tröger  <enrico.troeger at uvena.de>
+
+ * src/document.c:
+   Changed SEARCH_NOT_FOUND_TXT.
+   Fixed possible segfault when replacing tabs by spaces.
+
+
 2006-08-09  Enrico Tröger  <enrico.troeger at uvena.de>
 
  * doc/geany.docbook:

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2006-08-10 17:04:29 UTC (rev 694)
+++ trunk/src/document.c	2006-08-11 17:19:16 UTC (rev 695)
@@ -797,7 +797,8 @@
 }
 
 
-#define SEARCH_NOT_FOUND_TXT _("The match \"%s\" was not found. Wrap search around the document?")
+#define SEARCH_NOT_FOUND_TXT _("The document has been searched completely but the match \"%s\" \
+								was not found. Wrap search around the document?")
 
 /* special search function, used from the find entry in the toolbar */
 void document_find_next(gint idx, const gchar *text, gint flags, gboolean find_button, gboolean inc)
@@ -1335,7 +1336,7 @@
 		return;
 	}
 
-	text = g_malloc(len + (tabs_amount * (tab_w - 1)));
+	text = g_malloc(len + (tabs_amount * (tab_w - 1)) + 1);
 
 	for (i = 0; i < len; i++)
 	{
@@ -1354,7 +1355,9 @@
 			text[j++] = data[i];
 		}
 	}
-	geany_debug("tabs_amount: %d, len: %d, %d == %d", tabs_amount, len, len + (tabs_amount * (tab_w - 1)), j);
+	text[j] = '\0';
+
+	geany_debug("Replacing Tabs: tabs_amount: %d, text len: %d, j: %d", tabs_amount, len, j);
 	sci_set_text(doc_list[idx].sci, text);
 	sci_set_current_position(doc_list[idx].sci, pos);
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Commits mailing list