added extra byte to mallocs for nullterm in socket