diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c index 3e5d05100..9a9905d8f 100644 --- a/hw/vfb/InitOutput.c +++ b/hw/vfb/InitOutput.c @@ -280,7 +280,9 @@ ddxProcessArgument(int argc, char *argv[], int i) int screenNum; CHECK_FOR_REQUIRED_ARGUMENTS(2); screenNum = atoi(argv[i+1]); - if (screenNum < 0) + /* The protocol only has a CARD8 for number of screens in the + connection setup block, so don't allow more than that. */ + if ((screenNum < 0) || (screenNum >= 255)) { ErrorF("Invalid screen number %d\n", screenNum); UseMsg();