As all of the above have recommended, it's best to use a bucket or large fermenter with extra space when doing primary fermentation. When making wine from grapes, I use a large, 20-gallon fermenter (basically a food grade trash can) that is only filled about half way for my smaller batches. This leaves plenty of space for fermentation activity.
However, when doing a wine kit, I use a big mouth bubbler that provides extra space for fermentation foam. Even then, I have had some pretty active fermentations that have created a lot of foam that has filled all the extra space. In this case, I have used a blow off tube for these situations. Stick one end of 2-3 feet of tubing in the hole of a bung and place the bung in the carboy. Stick the other end of the tube in a bucket or jug of sulfite solution. Make sure the tube stays submerged in the liquid through the entire fermentation.
Even with this set up, it's possible for foam to make it's way into the tubing. But it wont fill the whole tube and it will never expose your must/wine to the air.
As most have stated, this isn't totally necessary as your must/wine should be pretty well protected from the CO2 blanket the fermentation itself creates. However, if you're paranoid like me, this is a good way to go.