net: Add explicit bound checks in net/socket.c