[patch] TODO for 4.6.1: ./file in tar archive
- From: Roland Illig <roland illig gmx de>
- To: MC Devel <mc-devel gnome org>
- Subject: [patch] TODO for 4.6.1: ./file in tar archive
- Date: Thu, 30 Sep 2004 19:52:50 +0200
Hi,
this patch fixes the second TODO item for 4.6.1. It is not perfect, but
it works. We should do much more error checking at this point, for
example for "../file" or similar things. Therefore we should use a
function like canonicalize_pathname from src/utilunix.c. We cannot use
that function because of license issues (utilunix.c is GPL, vfs is LGPL)
and dependency conflicts (src uses vfs, so vfs cannot use src; see ld(1)
for further information).
Roland
Index: tar.c
===================================================================
RCS file: /cvsroot/mc/mc/vfs/tar.c,v
retrieving revision 1.66
diff -u -r1.66 tar.c
--- tar.c 24 Sep 2004 23:00:18 -0000 1.66
+++ tar.c 30 Sep 2004 17:47:34 -0000
@@ -479,6 +479,11 @@
} else {
*(p++) = 0;
q = current_file_name;
+ /* FIXME: should be q = vfs_normalize_dir(q) */
+ while (q[0] == '.' && q[1] == '/')
+ q += 2;
+ if (*q == '.' && *(q+1) == '\0')
+ q = "";
}
parent =
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]