diff options
author | Denys Vlasenko | 2010-01-08 18:07:33 +0100 |
---|---|---|
committer | Denys Vlasenko | 2010-01-08 18:07:33 +0100 |
commit | 6fd42b3d00bb35d38eaa0fc64409992a4760f749 (patch) | |
tree | ddb6d431df1e46cc48a7956560400eeb4cdbd014 /archival | |
parent | 866710a05616be518d9d32261b52c9f81a025fe1 (diff) | |
download | busybox-6fd42b3d00bb35d38eaa0fc64409992a4760f749.zip busybox-6fd42b3d00bb35d38eaa0fc64409992a4760f749.tar.gz |
dpkg: fix handling of names with leading dots. Closes bug 783
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival')
-rw-r--r-- | archival/dpkg.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/archival/dpkg.c b/archival/dpkg.c index 616bce9..9f58b54 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c @@ -1493,7 +1493,18 @@ static void FAST_FUNC data_extract_all_prefix(archive_handle_t *archive_handle) { char *name_ptr = archive_handle->file_header->name; - name_ptr += strspn(name_ptr, "./"); + /* Skip all leading "/" */ + while (*name_ptr == '/') + name_ptr++; + /* Skip all leading "./" and "../" */ + while (name_ptr[0] == '.') { + if (name_ptr[1] == '.' && name_ptr[2] == '/') + name_ptr++; + if (name_ptr[1] != '/') + break; + name_ptr += 2; + } + if (name_ptr[0] != '\0') { archive_handle->file_header->name = xasprintf("%s%s", archive_handle->dpkg__buffer, name_ptr); data_extract_all(archive_handle); |