aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2012-05-01 14:30:06 +0300
committerTimo Teräs <timo.teras@iki.fi>2012-05-01 14:30:06 +0300
commit38c1e65afbb334af0107c6bdd5362303473d866f (patch)
tree49bdf851c4e434285100b3273469dc70edbd503f
parentb8f826e3b7f3893a9a42ede031c412590d3403d5 (diff)
downloadapk-tools-38c1e65afbb334af0107c6bdd5362303473d866f.tar.bz2
apk-tools-38c1e65afbb334af0107c6bdd5362303473d866f.tar.xz
db: strip leading and trailing slashes from protected path spec
-rw-r--r--src/database.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/database.c b/src/database.c
index 26774be..bcc707f 100644
--- a/src/database.c
+++ b/src/database.c
@@ -1181,6 +1181,12 @@ static int add_protected_path(void *ctx, apk_blob_t blob)
break;
}
+ /* skip leading and trailing path separators */
+ while (blob.len && blob.ptr[0] == '/')
+ blob.ptr++, blob.len--;
+ while (blob.len && blob.ptr[blob.len-1] == '/')
+ blob.len--;
+
*apk_protected_path_array_add(&db->protected_paths) = (struct apk_protected_path) {
.relative_pattern = apk_blob_cstr(blob),
.protected = protected,