modified from https://github.com/plougher/squashfs-tools/pull/69 Index: squashfs-tools/action.c --- squashfs-tools/action.c.orig +++ squashfs-tools/action.c @@ -2284,9 +2284,12 @@ static char *get_start(char *s, int n) static int subpathname_fn(struct atom *atom, struct action_data *action_data) { - return fnmatch(atom->argv[0], get_start(strdupa(action_data->subpath), + char *path = strdup(action_data->subpath); + int is_match = fnmatch(atom->argv[0], get_start(path, count_components(atom->argv[0])), FNM_PATHNAME|FNM_PERIOD|FNM_EXTMATCH) == 0; + free(path); + return is_match; } /*