nfqws: prohibit extra modes in --dpi-desync

This commit is contained in:
bol-van 2021-04-11 18:53:47 +03:00
parent 83f18fbe63
commit 86241cb56c

View File

@ -712,9 +712,12 @@ int main(int argc, char **argv)
{ {
mode = mode2; mode = mode2;
mode2 = mode3; mode2 = mode3;
mode3 = NULL;
} }
else else
{
params.desync_mode0 = DESYNC_NONE; params.desync_mode0 = DESYNC_NONE;
}
params.desync_mode = desync_mode_from_string(mode); params.desync_mode = desync_mode_from_string(mode);
params.desync_mode2 = desync_mode_from_string(mode2); params.desync_mode2 = desync_mode_from_string(mode2);
if (params.desync_mode0==DESYNC_INVALID || params.desync_mode==DESYNC_INVALID || params.desync_mode2==DESYNC_INVALID) if (params.desync_mode0==DESYNC_INVALID || params.desync_mode==DESYNC_INVALID || params.desync_mode2==DESYNC_INVALID)
@ -722,6 +725,11 @@ int main(int argc, char **argv)
fprintf(stderr, "invalid dpi-desync mode\n"); fprintf(stderr, "invalid dpi-desync mode\n");
exit_clean(1); exit_clean(1);
} }
if (mode3)
{
fprintf(stderr, "invalid desync combo : %s+%s+%s\n",mode,mode2,mode3);
exit_clean(1);
}
if (params.desync_mode2 && !(desync_valid_first_stage(params.desync_mode) && desync_valid_second_stage(params.desync_mode2))) if (params.desync_mode2 && !(desync_valid_first_stage(params.desync_mode) && desync_valid_second_stage(params.desync_mode2)))
{ {
fprintf(stderr, "invalid desync combo : %s+%s\n", mode,mode2); fprintf(stderr, "invalid desync combo : %s+%s\n", mode,mode2);