summaryrefslogtreecommitdiffstats
path: root/exfat/libexfat/node.c
diff options
context:
space:
mode:
authorbigbiff bigbiff <bigbiff@teamw.in>2013-01-28 14:14:25 +0100
committerDees_Troy <dees_troy@teamw.in>2013-01-28 16:24:04 +0100
commitca829c4b81bfcdb7ea676694c5cfd0b79ccbb646 (patch)
treec182c6075b31a4536edcfa41f290b5e7e6caa8c2 /exfat/libexfat/node.c
parentMerge "Pull fix for exFAT from original source" into twrp2.4 (diff)
downloadandroid_bootable_recovery-ca829c4b81bfcdb7ea676694c5cfd0b79ccbb646.tar
android_bootable_recovery-ca829c4b81bfcdb7ea676694c5cfd0b79ccbb646.tar.gz
android_bootable_recovery-ca829c4b81bfcdb7ea676694c5cfd0b79ccbb646.tar.bz2
android_bootable_recovery-ca829c4b81bfcdb7ea676694c5cfd0b79ccbb646.tar.lz
android_bootable_recovery-ca829c4b81bfcdb7ea676694c5cfd0b79ccbb646.tar.xz
android_bootable_recovery-ca829c4b81bfcdb7ea676694c5cfd0b79ccbb646.tar.zst
android_bootable_recovery-ca829c4b81bfcdb7ea676694c5cfd0b79ccbb646.zip
Diffstat (limited to '')
-rw-r--r--exfat/libexfat/node.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/exfat/libexfat/node.c b/exfat/libexfat/node.c
index bacb01d10..ff2cea9ab 100644
--- a/exfat/libexfat/node.c
+++ b/exfat/libexfat/node.c
@@ -2,7 +2,7 @@
node.c (09.10.09)
exFAT file system implementation library.
- Copyright (C) 2010-2012 Andrew Nayenko
+ Copyright (C) 2010-2013 Andrew Nayenko
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -486,7 +486,7 @@ void exfat_reset_cache(struct exfat* ef)
reset_cache(ef, ef->root);
}
-void next_entry(struct exfat* ef, const struct exfat_node* parent,
+static void next_entry(struct exfat* ef, const struct exfat_node* parent,
cluster_t* cluster, off64_t* offset)
{
*offset += sizeof(struct exfat_entry);
@@ -908,6 +908,23 @@ int exfat_rename(struct exfat* ef, const char* old_path, const char* new_path)
exfat_put_node(ef, node);
return rc;
}
+
+ /* check that target is not a subdirectory of the source */
+ if (node->flags & EXFAT_ATTRIB_DIR)
+ {
+ struct exfat_node* p;
+
+ for (p = dir; p; p = p->parent)
+ if (node == p)
+ {
+ if (existing != NULL)
+ exfat_put_node(ef, existing);
+ exfat_put_node(ef, dir);
+ exfat_put_node(ef, node);
+ return -EINVAL;
+ }
+ }
+
if (existing != NULL)
{
/* remove target if it's not the same node as source */