gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r12187 - in gnunet: . src/fs


From: gnunet
Subject: [GNUnet-SVN] r12187 - in gnunet: . src/fs
Date: Fri, 9 Jul 2010 12:23:40 +0200

Author: grothoff
Date: 2010-07-09 12:23:40 +0200 (Fri, 09 Jul 2010)
New Revision: 12187

Modified:
   gnunet/TODO
   gnunet/src/fs/fs_download.c
   gnunet/src/fs/fs_file_information.c
Log:
naming

Modified: gnunet/TODO
===================================================================
--- gnunet/TODO 2010-07-09 10:07:43 UTC (rev 12186)
+++ gnunet/TODO 2010-07-09 10:23:40 UTC (rev 12187)
@@ -17,9 +17,6 @@
   - implement testcases
   - implement performance tests
 * FS: [CG]
-  - publishing a directory sets the embedded filename to "empty" 
-    (likely an issue with cutting off everything before '/' in the filename,
-     which in the case of a directory would leave nothing)
   - trust: do not charge when "idle" / load considerations (migration, routing)
   - bound our priorities based on priorities used by other peers
   - datastore reservation (publishing)

Modified: gnunet/src/fs/fs_download.c
===================================================================
--- gnunet/src/fs/fs_download.c 2010-07-09 10:07:43 UTC (rev 12186)
+++ gnunet/src/fs/fs_download.c 2010-07-09 10:23:40 UTC (rev 12187)
@@ -702,6 +702,7 @@
   char *us;
   char *ext;
   char *dn;
+  char *pos;
   char *full_name;
 
   if (NULL == uri)
@@ -722,7 +723,7 @@
   fn = NULL;
   if (NULL == filename)
     {
-      fn = GNUNET_FS_meta_data_suggest_filename (meta);      
+      fn = GNUNET_FS_meta_data_suggest_filename (meta);
       if (fn == NULL)
        {
          us = GNUNET_FS_uri_to_string (uri);
@@ -741,6 +742,20 @@
          GNUNET_free (ext);
          GNUNET_free (us);
        }
+      /* change '\' to '/' (this should have happened
+       during insertion, but malicious peers may
+       not have done this) */
+      while (NULL != (pos = strstr (fn, "\\")))
+       *pos = '/';
+      /* remove '../' everywhere (again, well-behaved
+        peers don't do this, but don't trust that
+        we did not get something nasty) */
+      while (NULL != (pos = strstr (fn, "../")))
+       {
+         pos[0] = '_';
+         pos[1] = '_';
+         pos[2] = '_';
+       }
       filename = fn;
     }
   if (dc->filename == NULL)

Modified: gnunet/src/fs/fs_file_information.c
===================================================================
--- gnunet/src/fs/fs_file_information.c 2010-07-09 10:07:43 UTC (rev 12186)
+++ gnunet/src/fs/fs_file_information.c 2010-07-09 10:23:40 UTC (rev 12187)
@@ -612,8 +612,9 @@
       dc.entries = dc.entries->next;
     }
   fn = filename;
-  while (NULL != (ss = strstr (fn,
-                              DIR_SEPARATOR_STR)))
+  while ( (NULL != (ss = strstr (fn,
+                                DIR_SEPARATOR_STR))) &&
+         (strlen (ss) > 1) )
     fn = ss + 1;
   GNUNET_CONTAINER_meta_data_insert (ret->meta,
                                     "<gnunet>",




reply via email to

[Prev in Thread] Current Thread [Next in Thread]