fixed buffer overflow and use of uninitialized memory in handle_dns_login

This commit is contained in:
WGH 2016-08-03 01:15:06 +03:00
parent 4c2f9bf4b7
commit 93cf0e67ba

View File

@ -1532,7 +1532,7 @@ handle_dns_login(int dns_fd, struct query *q, uint8_t *domain, int domain_len, i
tcp_forward_error: tcp_forward_error:
DEBUG(1, "Failed to connect TCP forward for user %d: %s", userid, errormsg); DEBUG(1, "Failed to connect TCP forward for user %d: %s", userid, errormsg);
out[0] = 'E'; out[0] = 'E';
strncat(out + 1, errormsg, sizeof(out) - 1); strncpy(out + 1, errormsg, sizeof(out) - 1);
read = strlen(out); read = strlen(out);
write_dns(dns_fd, q, out, read + 1, u->downenc); write_dns(dns_fd, q, out, read + 1, u->downenc);
} }