fixed off-by-one array index causing stack corruption
fixed compat implementation of getaddrinfo