net: fix buffer overrun in socket initialization