bin: copy: fix segfault for one argument

The code assumes both SRC and DST is passed, here we ensure this
early.

Prior to this patch:
root@host:~$ copy foo
Segmentation fault (core dumped)

Signed-off-by: Richard Alpe <richard@bit42.se>
This commit is contained in:
Richard Alpe
2025-03-11 09:30:46 +01:00
parent 95931c8c0a
commit b8fc8b7f62
+1 -1
View File
@@ -418,7 +418,7 @@ int main(int argc, char *argv[])
if (timeout < 0)
timeout = 120;
if (optind >= argc)
if (argc - optind != 2)
return usage(1);
src = argv[optind++];