file_header->name = concat_path_file(tar.prefix, tar.name);
} else
file_header->name = xstrdup(tar.name);
- /* FIXME: add check for /../ attacks */
}
/* Set bits 12-15 of the files mode */
linkname = NULL;
}
#endif
+ if (!strncmp(file_header->name, "/../"+1, 3)
+ || strstr(file_header->name, "/../")
+ ) {
+ bb_error_msg_and_die("name with '..' encountered: '%s'",
+ file_header->name);
+ }
/* Strip trailing '/' in directories */
/* Must be done after mode is set as '/' is used to check if its a directory */