aboutsummaryrefslogtreecommitdiffstats
path: root/src/fcopy
diff options
context:
space:
mode:
authorLibravatar smitsohu <smitsohu@gmail.com>2022-03-10 14:43:17 +0100
committerLibravatar smitsohu <smitsohu@gmail.com>2022-03-10 14:43:17 +0100
commit4d3d3270883140535cc6ea5a190aebdf6f3dc120 (patch)
tree7bae03cfce71b7f13bba30fe907354d97d40df74 /src/fcopy
parentRELNOTES: add warning about allow-tray (diff)
downloadfirejail-4d3d3270883140535cc6ea5a190aebdf6f3dc120.tar.gz
firejail-4d3d3270883140535cc6ea5a190aebdf6f3dc120.tar.zst
firejail-4d3d3270883140535cc6ea5a190aebdf6f3dc120.zip
refactor meta character filtering
Diffstat (limited to 'src/fcopy')
-rw-r--r--src/fcopy/main.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/fcopy/main.c b/src/fcopy/main.c
index c64d20127..e56d853c8 100644
--- a/src/fcopy/main.c
+++ b/src/fcopy/main.c
@@ -472,18 +472,12 @@ int main(int argc, char **argv) {
472 size_t len = strlen(src); 472 size_t len = strlen(src);
473 while (len > 1 && src[len - 1] == '/') 473 while (len > 1 && src[len - 1] == '/')
474 src[--len] = '\0'; 474 src[--len] = '\0';
475 if (strcspn(src, "\\*&!?\"'<>%^(){}[];,") != len) { 475 reject_meta_chars(src, 0);
476 fprintf(stderr, "Error fcopy: invalid source file name %s\n", src);
477 exit(1);
478 }
479 476
480 len = strlen(dest); 477 len = strlen(dest);
481 while (len > 1 && dest[len - 1] == '/') 478 while (len > 1 && dest[len - 1] == '/')
482 dest[--len] = '\0'; 479 dest[--len] = '\0';
483 if (strcspn(dest, "\\*&!?\"'<>%^(){}[];,~") != len) { 480 reject_meta_chars(dest, 0);
484 fprintf(stderr, "Error fcopy: invalid dest file name %s\n", dest);
485 exit(1);
486 }
487 481
488 // the destination should be a directory; 482 // the destination should be a directory;
489 struct stat s; 483 struct stat s;