The majority of massive stars resides in binary systems, which are expected to experience mass transfer during their evolution. However, the conditions under which mass transfer leads to a common envelope, and thus possibly to a merging of both stars, are currently only poorly understood. The main uncertainties arise from the possible swelling of the mass gainer and from angular momentum loss from the binary system during non-conservative mass transfer. We have computed a dense grid of detailed models of stars that accrete mass at constant rates to determine the radius increase that is due to their thermal disequilibrium. While we find that models with an accretion that is faster than the thermal timescale expand in general, this expansion remains quite limited in the intermediate-mass regime even for accretion rates that exceed the thermal timescale accretion rate by a factor of 100. Our models of massive stars expand to extreme radii under these conditions. When the accretion rate exceed the Eddington accretion rate, our models expand rapidly. We derived analytical fits to the radius evolution of our models and a prescription for the boundary between stable mass transfer and overflow for arbitrary accretion efficiencies. We then applied our results to grids of binary models adopting various constant mass-transfer efficiencies and angular momentum budgets. We find that the first parameter affects the outcome of the Roche-lobe overflow more strongly. Our results are consistent with detailed binary evolution models and often lead to a smaller initial parameter space for stable mass transfer than do other recipes in the literature. We used this method to investigate the origin of Wolf-Rayet stars with O star companions in the Small Magellanic Cloud, and we found that the efficiency of the mass transfer process that led to the formation of the Wolf-Rayet star was likely lower than 50<!PCT!>.