SF.net SVN: geany:[4572] branches/geany-0.18.1

ntrel at users.sourceforge.net ntrel at xxxxx
Thu Jan 28 13:13:51 UTC 2010


Revision: 4572
          http://geany.svn.sourceforge.net/geany/?rev=4572&view=rev
Author:   ntrel
Date:     2010-01-28 13:13:50 +0000 (Thu, 28 Jan 2010)

Log Message:
-----------
Backport from trunk:
Fix opening filenames beginning with two dots (closes #2858487).

Modified Paths:
--------------
    branches/geany-0.18.1/ChangeLog
    branches/geany-0.18.1/src/utils.c

Modified: branches/geany-0.18.1/ChangeLog
===================================================================
--- branches/geany-0.18.1/ChangeLog	2010-01-28 13:10:44 UTC (rev 4571)
+++ branches/geany-0.18.1/ChangeLog	2010-01-28 13:13:50 UTC (rev 4572)
@@ -1,3 +1,9 @@
+2009-09-14  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/utils.c:
+   Fix opening filenames beginning with two dots (closes #2858487).
+
+
 2009-09-13  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
 
  * src/keybindings.c:

Modified: branches/geany-0.18.1/src/utils.c
===================================================================
--- branches/geany-0.18.1/src/utils.c	2010-01-28 13:10:44 UTC (rev 4571)
+++ branches/geany-0.18.1/src/utils.c	2010-01-28 13:13:50 UTC (rev 4572)
@@ -1726,8 +1726,8 @@
 	utils_string_replace_all(str, G_DIR_SEPARATOR_S "." G_DIR_SEPARATOR_S, G_DIR_SEPARATOR_S);
 	utils_string_replace_all(str, G_DIR_SEPARATOR_S G_DIR_SEPARATOR_S, G_DIR_SEPARATOR_S);
 
-	/* replace "/.." */
-	needle = G_DIR_SEPARATOR_S "..";
+	/* replace "/../" */
+	needle = G_DIR_SEPARATOR_S ".." G_DIR_SEPARATOR_S;
 	while (1)
 	{
 		c = strstr(str->str, needle);
@@ -1739,9 +1739,11 @@
 			if (pos <= 3)
 				break;	/* bad path */
 
-			g_string_erase(str, pos, strlen(needle));	/* erase "/.." */
+			/* replace "/../" */
+			g_string_erase(str, pos, strlen(needle));
+			g_string_insert_c(str, pos, G_DIR_SEPARATOR);
 
-			tmp = g_strndup(str->str, pos);	/* path up to "/.." */
+			tmp = g_strndup(str->str, pos);	/* path up to "/../" */
 			c = g_strrstr(tmp, G_DIR_SEPARATOR_S);
 			g_return_if_fail(c);
 


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