db: strip leading and trailing slashes from protected path spec

cute-signatures
Timo Teräs 2012-05-01 14:30:06 +03:00
parent b8f826e3b7
commit 38c1e65afb
1 changed files with 6 additions and 0 deletions

View File

@ -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,