For an ICC tournament, the squad size, as well as the date it must be submitted by, are fixed. Look at the rules for the specific tournament for the allowed squad size.
For a bilateral tour, squads can be as small or large as the teams like. For the first ever Eng/Aus tour, England sailed over with only 12 men, one of whom caught a STD early in the tour leaving the squad with only the bare eleven. Modern touring squads are much larger and often have the 'A'-team touring nearby to provide even more cricketers in case of injury.
Home squads are effectivly unlimited in size. While home teams often name a 12-man squad a day or two before the game, there is nothing stopping the home coach from naming a 12 man squad but, 30 minutes before the match starts, going down the nearby pub and grabbing eleven locals to play.