hostname may not NULL-terminate the string if the buffer is too small.

Thanks to Kevin M. Hildebrand for catching this.

cmr=v1.7.3:reviewer=jsquyres