diff options
author | Timo Teräs <timo.teras@iki.fi> | 2012-05-01 14:30:06 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2012-05-01 14:30:06 +0300 |
commit | 38c1e65afbb334af0107c6bdd5362303473d866f (patch) | |
tree | 49bdf851c4e434285100b3273469dc70edbd503f /src/database.c | |
parent | b8f826e3b7f3893a9a42ede031c412590d3403d5 (diff) | |
download | apk-tools-38c1e65afbb334af0107c6bdd5362303473d866f.tar.gz apk-tools-38c1e65afbb334af0107c6bdd5362303473d866f.tar.bz2 apk-tools-38c1e65afbb334af0107c6bdd5362303473d866f.tar.xz apk-tools-38c1e65afbb334af0107c6bdd5362303473d866f.zip |
db: strip leading and trailing slashes from protected path spec
Diffstat (limited to 'src/database.c')
-rw-r--r-- | src/database.c | 6 |
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, |