diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-07-09 10:23:40 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-07-09 10:23:40 +0000 |
commit | 759c8de73603135f58ee93395644e9829d3f72c3 (patch) | |
tree | ca0e22846a713d770495e0ee9034625fff9f809e /src/fs | |
parent | 0cada45a69334845c7efbd3c17c1b5b98f9ce2a1 (diff) | |
download | gnunet-759c8de73603135f58ee93395644e9829d3f72c3.tar.gz gnunet-759c8de73603135f58ee93395644e9829d3f72c3.zip |
naming
Diffstat (limited to 'src/fs')
-rw-r--r-- | src/fs/fs_download.c | 17 | ||||
-rw-r--r-- | src/fs/fs_file_information.c | 5 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index 1ee4355ad..53bad3126 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c | |||
@@ -702,6 +702,7 @@ trigger_recursive_download (void *cls, | |||
702 | char *us; | 702 | char *us; |
703 | char *ext; | 703 | char *ext; |
704 | char *dn; | 704 | char *dn; |
705 | char *pos; | ||
705 | char *full_name; | 706 | char *full_name; |
706 | 707 | ||
707 | if (NULL == uri) | 708 | if (NULL == uri) |
@@ -722,7 +723,7 @@ trigger_recursive_download (void *cls, | |||
722 | fn = NULL; | 723 | fn = NULL; |
723 | if (NULL == filename) | 724 | if (NULL == filename) |
724 | { | 725 | { |
725 | fn = GNUNET_FS_meta_data_suggest_filename (meta); | 726 | fn = GNUNET_FS_meta_data_suggest_filename (meta); |
726 | if (fn == NULL) | 727 | if (fn == NULL) |
727 | { | 728 | { |
728 | us = GNUNET_FS_uri_to_string (uri); | 729 | us = GNUNET_FS_uri_to_string (uri); |
@@ -741,6 +742,20 @@ trigger_recursive_download (void *cls, | |||
741 | GNUNET_free (ext); | 742 | GNUNET_free (ext); |
742 | GNUNET_free (us); | 743 | GNUNET_free (us); |
743 | } | 744 | } |
745 | /* change '\' to '/' (this should have happened | ||
746 | during insertion, but malicious peers may | ||
747 | not have done this) */ | ||
748 | while (NULL != (pos = strstr (fn, "\\"))) | ||
749 | *pos = '/'; | ||
750 | /* remove '../' everywhere (again, well-behaved | ||
751 | peers don't do this, but don't trust that | ||
752 | we did not get something nasty) */ | ||
753 | while (NULL != (pos = strstr (fn, "../"))) | ||
754 | { | ||
755 | pos[0] = '_'; | ||
756 | pos[1] = '_'; | ||
757 | pos[2] = '_'; | ||
758 | } | ||
744 | filename = fn; | 759 | filename = fn; |
745 | } | 760 | } |
746 | if (dc->filename == NULL) | 761 | if (dc->filename == NULL) |
diff --git a/src/fs/fs_file_information.c b/src/fs/fs_file_information.c index 1973e2bc1..e0403b2ed 100644 --- a/src/fs/fs_file_information.c +++ b/src/fs/fs_file_information.c | |||
@@ -612,8 +612,9 @@ GNUNET_FS_file_information_create_from_directory (struct GNUNET_FS_Handle *h, | |||
612 | dc.entries = dc.entries->next; | 612 | dc.entries = dc.entries->next; |
613 | } | 613 | } |
614 | fn = filename; | 614 | fn = filename; |
615 | while (NULL != (ss = strstr (fn, | 615 | while ( (NULL != (ss = strstr (fn, |
616 | DIR_SEPARATOR_STR))) | 616 | DIR_SEPARATOR_STR))) && |
617 | (strlen (ss) > 1) ) | ||
617 | fn = ss + 1; | 618 | fn = ss + 1; |
618 | GNUNET_CONTAINER_meta_data_insert (ret->meta, | 619 | GNUNET_CONTAINER_meta_data_insert (ret->meta, |
619 | "<gnunet>", | 620 | "<gnunet>", |