mirror of
https://github.com/sheumann/hush.git
synced 2024-12-22 14:30:31 +00:00
Don't allow mkfifo to create files such as "--help"
This patch checks if the name of FIFO to be created begins with "-" and calls usage() if it does. Regards, Pavel Roskin
This commit is contained in:
parent
ef4268efa7
commit
46a38dbb9b
@ -60,7 +60,7 @@ extern int mkfifo_main(int argc, char **argv)
|
|||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
if (argc < 1)
|
if (argc < 1 || *argv[0] == '-')
|
||||||
usage(mkfifo_usage);
|
usage(mkfifo_usage);
|
||||||
if (mkfifo(*argv, mode) < 0) {
|
if (mkfifo(*argv, mode) < 0) {
|
||||||
perror("mkfifo");
|
perror("mkfifo");
|
||||||
|
2
mkfifo.c
2
mkfifo.c
@ -60,7 +60,7 @@ extern int mkfifo_main(int argc, char **argv)
|
|||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
if (argc < 1)
|
if (argc < 1 || *argv[0] == '-')
|
||||||
usage(mkfifo_usage);
|
usage(mkfifo_usage);
|
||||||
if (mkfifo(*argv, mode) < 0) {
|
if (mkfifo(*argv, mode) < 0) {
|
||||||
perror("mkfifo");
|
perror("mkfifo");
|
||||||
|
Loading…
Reference in New Issue
Block a user