aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2002-09-30 20:14:57 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2002-09-30 20:14:57 +0000
commit149c26e8b58c1e1a403f2f4eaaffa9dd2d33f405 (patch)
treee1fff694cdfa35b6a5bb12a56f1b1cf273d811bb
parent069fbf412410376de47f130ebda2a6fca831ed92 (diff)
downloadbusybox-w32-149c26e8b58c1e1a403f2f4eaaffa9dd2d33f405.tar.gz
busybox-w32-149c26e8b58c1e1a403f2f4eaaffa9dd2d33f405.tar.bz2
busybox-w32-149c26e8b58c1e1a403f2f4eaaffa9dd2d33f405.zip
Patch from Konstantin Isakov <ikm@pisem.net>:
In most cases, dirname returns the same argument it was given, so this code works nice, but there's one special case: when the name contains no dirname, it returns "." (stored statically in the body of itself), and we get a segfault in attempt to free() it. This patch fixes this problem. git-svn-id: svn://busybox.net/trunk/busybox@5609 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r--archival/libunarchive/data_extract_all.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/archival/libunarchive/data_extract_all.c b/archival/libunarchive/data_extract_all.c
index a80f422b7..39af2e3e7 100644
--- a/archival/libunarchive/data_extract_all.c
+++ b/archival/libunarchive/data_extract_all.c
@@ -16,9 +16,10 @@ extern void data_extract_all(archive_handle_t *archive_handle)
16 int res; 16 int res;
17 17
18 if (archive_handle->flags & ARCHIVE_CREATE_LEADING_DIRS) { 18 if (archive_handle->flags & ARCHIVE_CREATE_LEADING_DIRS) {
19 char *dir = dirname(strdup(file_header->name)); 19 char *name = strdup(file_header->name);
20 make_directory (dir, 0777, FILEUTILS_RECUR); 20 make_directory (dirname(name), 0777, FILEUTILS_RECUR);
21 } 21 free(name);
22 }
22 23
23 /* Create the file */ 24 /* Create the file */
24 switch(file_header->mode & S_IFMT) { 25 switch(file_header->mode & S_IFMT) {