From c501a3903f89215706bf86bea3a6b2c25863c5a1 Mon Sep 17 00:00:00 2001 From: Erik Ekman Date: Mon, 1 Jun 2009 18:39:01 +0000 Subject: [PATCH] Merge branch 'master' into iodine-0.5 --- CHANGELOG | 5 +++++ src/iodine.c | 9 +++++++-- src/tun.c | 3 ++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 1b792b8..8a647f8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,11 @@ iodine - http://code.kryo.se/iodine CHANGES: +2009-06-01: 0.5.2 "WifiFree" + - Fixed client segfault on OS X, #57 + - Added check that nameserver lookup was successful + - Fixed ENOTSOCK error on OS X and FreeBSD, #58. + 2009-03-21: 0.5.1 "Boringo" - Added initial Windows support, fixes #43. - Added length check of autoprobe responses diff --git a/src/iodine.c b/src/iodine.c index 65e47bc..8c2bc93 100644 --- a/src/iodine.c +++ b/src/iodine.c @@ -231,7 +231,7 @@ tunnel_tun(int tun_fd, int dns_fd) unsigned long inlen; char out[64*1024]; char in[64*1024]; - size_t read; + ssize_t read; if ((read = read_tun(tun_fd, in, sizeof(in))) <= 0) return -1; @@ -1100,7 +1100,12 @@ main(int argc, char **argv) /* NOTREACHED */ } - set_nameserver(nameserv_addr); + if (nameserv_addr) { + set_nameserver(nameserv_addr); + } else { + usage(); + /* NOTREACHED */ + } if(strlen(topdomain) <= 128) { if(check_topdomain(topdomain)) { diff --git a/src/tun.c b/src/tun.c index 57b369d..4f40dd4 100644 --- a/src/tun.c +++ b/src/tun.c @@ -360,7 +360,8 @@ read_tun(int tun_fd, char *buf, size_t len) #if defined (FREEBSD) || defined (DARWIN) || defined(NETBSD) || defined(WINDOWS32) /* FreeBSD/Darwin/NetBSD has no header */ int bytes; - bytes = recv(tun_fd, buf + 4, len, 0); + memset(buf, 0, 4); + bytes = read(tun_fd, buf + 4, len - 4); if (bytes < 0) { return bytes; } else {