otya128 / winevdm

16-bit Windows (Windows 1.x, 2.x, 3.0, 3.1, etc.) on 64-bit Windows
GNU General Public License v2.0
2.69k stars 154 forks source link

Wrong assignment of 'first_arg' in winevdm.c when using command option "--app-name" #1411

Open luispaulomr opened 6 months ago

luispaulomr commented 6 months ago

I was messing around with command options in winevdm.c and this code seems wrong (line 838):

if (!strcmp( argv[1], "--app-name" ))
    {
        if (!(appname = argv[2])) usage();
        first_arg = argv + 3; /* this */
    }

At the end of this if, 'first_arg' should point to the app name, not to the next position. I could be wrong, though. But that's what I understood by reading the code. Currently, it's discarding the first argument.

For example, running the following command:

ovtdm.exe --app-name app.exe arg1 arg2 arg3 arg4

Outputs

3188:trace:winevdm:main cmdline = 'arg2 arg3 arg4'

So, the assignment should instead be:

first_arg = argv + 2;