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.
This commit is contained in:
parent
aa1d6ccbfb
commit
d9d47c3078
@ -16,8 +16,9 @@ extern void data_extract_all(archive_handle_t *archive_handle)
|
||||
int res;
|
||||
|
||||
if (archive_handle->flags & ARCHIVE_CREATE_LEADING_DIRS) {
|
||||
char *dir = dirname(strdup(file_header->name));
|
||||
make_directory (dir, 0777, FILEUTILS_RECUR);
|
||||
char *name = strdup(file_header->name);
|
||||
make_directory (dirname(name), 0777, FILEUTILS_RECUR);
|
||||
free(name);
|
||||
}
|
||||
|
||||
/* Create the file */
|
||||
|
Loading…
Reference in New Issue
Block a user