A few corrections to hostfile parsing - thanks to Tetsuya Mishima for the review

Refs #4136
Cleanup some potential memory overruns

cmr=v1.7.5:reviewer=jsquyres