Skip to content

Commit 574b8ba

Browse files
committed
qvm-copy: Allow non-canonical symbolic links
These are used in the wild. For instance, Busybox includes symlinks to './busybox' instead of just 'busybox'. Fixes QubesOS/qubes-issues#10308
1 parent bffc6e0 commit 574b8ba

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

qubes-rpc/qfile-unpacker.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ int main(int argc, char ** argv)
106106
char *procdir_path;
107107
int procfs_fd;
108108
int i, ret;
109-
int flags = COPY_ALLOW_SYMLINKS | COPY_ALLOW_DIRECTORIES;
109+
int flags = COPY_ALLOW_SYMLINKS | COPY_ALLOW_DIRECTORIES | COPY_ALLOW_NON_CANONICAL_SYMLINKS;
110110
if (argc < 1)
111111
errx(EXIT_FAILURE, "NULL argv[0] passed to execve()");
112112
if (argc >= 3 && argv[1][0] >= '0' && argv[1][0] <= '9') {

qubes-rpc/qubes-fs-tree-check.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ process_dirent(const char *d_name, int fd, int flags, const char *name,
146146
// charset checks done already, do not repeat them
147147
if (qubes_pure_validate_symbolic_link_v2((const uint8_t *)name,
148148
(const uint8_t *)buf,
149-
QUBES_PURE_ALLOW_UNSAFE_CHARACTERS) < 0)
149+
QUBES_PURE_ALLOW_UNSAFE_CHARACTERS |
150+
QUBES_PURE_ALLOW_NON_CANONICAL_SYMLINKS) < 0)
150151
errx(1, "Refusing to copy unsafe symbolic link %s", escaped);
151152
free(buf);
152153
return bad;

0 commit comments

Comments
 (0)