checking return value from decompress, to avoid sending 64k packages on the tun every time there is a datacorruption

This commit is contained in:
Bjorn Andersson 2007-02-10 22:52:15 +00:00
parent 16e9df4164
commit 757f59e350

View File

@ -166,7 +166,8 @@ tunnel_dns(int tun_fd, int dns_fd)
outlen = sizeof(out); outlen = sizeof(out);
inlen = read; inlen = read;
uncompress(out, &outlen, in, inlen); if (uncompress(out, &outlen, in, inlen) != Z_OK)
return -1;
write_tun(tun_fd, out, outlen); write_tun(tun_fd, out, outlen);
if (!is_sending()) if (!is_sending())
@ -362,6 +363,7 @@ handshake(int dns_fd)
perform_login: perform_login:
login_calculate(login, 16, password, seed); login_calculate(login, 16, password, seed);
for (i=0; running && i<5 ;i++) { for (i=0; running && i<5 ;i++) {
tv.tv_sec = i + 1; tv.tv_sec = i + 1;
tv.tv_usec = 0; tv.tv_usec = 0;