X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=tun.c;h=d4070f2ef405d7e8316bf23a84837189a05eddef;hb=92795040;hp=c511dbe23adb2ae510e70f8651fc269e8accbe3a;hpb=5540bab74ca1a39639a098d15e87daf45d83b7ec;p=secnet.git diff --git a/tun.c b/tun.c index c511dbe..d4070f2 100644 --- a/tun.c +++ b/tun.c @@ -116,7 +116,7 @@ static void tun_afterpoll(void *sst, struct pollfd *fds, int nfds) if (fds[0].revents&POLLIN) { BUF_ALLOC(st->buff,"tun_afterpoll"); buffer_init(st->buff,calculate_max_start_pad()); - l=read(st->fd,st->buff->start,st->buff->len-calculate_max_start_pad()); + l=read(st->fd, st->buff->start, buf_remaining_space(st->buff)); if (l<0) { fatal_perror("tun_afterpoll: read()"); }