xinstall: Fix broken memmove with -t

memmove moves a number of bytes, not pointers, so if you passed a number
of arguments that is larger than the pointer byte size, you could
end up crashing or skipping the install of a file and installing another
twice.

Also, argv was never decreased to match the moved arguments, so the -t
parameter was added in the NULL argv slot.
This commit is contained in:
Michael Forney 2016-12-27 13:48:31 +01:00 committed by Laslo Hunhold
parent 87f40834a3
commit b7fb3a58e7
1 changed files with 1 additions and 1 deletions

View File

@ -219,7 +219,7 @@ main(int argc, char *argv[])
mode = parsemode(mflag, mode, 0);
if (tflag) {
memmove(argv - 1, argv, argc);
argv = memmove(argv - 1, argv, argc * sizeof(*argv));
argv[argc++] = tflag;
}
if (tflag || argc > 2) {