diff options
author | peter <peter@FreeBSD.org> | 1996-11-15 15:56:45 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1996-11-15 15:56:45 +0000 |
commit | f30080a60881000903251551f6f46062dcacb65e (patch) | |
tree | e70fa644eaf3cf4171ee3e91d1ede874cda2b9e0 /usr.sbin | |
parent | 6926a0a5d18e3d56505b05c892e674fae254989e (diff) | |
download | FreeBSD-src-f30080a60881000903251551f6f46062dcacb65e.zip FreeBSD-src-f30080a60881000903251551f6f46062dcacb65e.tar.gz |
oops, forgot to commit this. the sockaddr_un init code was missing
initialisers for sun_len and not accounting for it in the sizeof
calculation. Ie: it was potentially sending an unterminated string into
the kernel.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/rpc.yppasswdd/yppasswd_comm.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/rpc.yppasswdd/yppasswd_comm.c b/usr.sbin/rpc.yppasswdd/yppasswd_comm.c index 28ea0cd..270051b 100644 --- a/usr.sbin/rpc.yppasswdd/yppasswd_comm.c +++ b/usr.sbin/rpc.yppasswdd/yppasswd_comm.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: yppasswd_comm.c,v 1.1.1.1 1996/02/12 15:09:01 wpaul Exp $ + * $Id: yppasswd_comm.c,v 1.2 1996/11/15 14:12:21 peter Exp $ */ /* @@ -73,7 +73,7 @@ #include "ypxfr_extern.h" #ifndef lint -static const char rcsid[] = "$Id: yppasswd_comm.c,v 1.1.1.1 1996/02/12 15:09:01 wpaul Exp $"; +static const char rcsid[] = "$Id: yppasswd_comm.c,v 1.2 1996/11/15 14:12:21 peter Exp $"; #endif char *sockname = "/var/run/ypsock"; @@ -147,7 +147,8 @@ int makeservsock() bzero((char *)&us, sizeof(us)); us.sun_family = AF_UNIX; strcpy((char *)&us.sun_path, sockname); - len = strlen(us.sun_path) + sizeof(us.sun_family) + 1; + us.sun_len = len = sizeof(us.sun_len) + sizeof(us.sun_family) + + strlen(us.sun_path) + 1; if (bind(ypsock, (struct sockaddr *)&us, len) == -1) err(1,"failed to bind UNIX domain socket"); @@ -175,7 +176,8 @@ static int makeclntsock() bzero((char *)&us, sizeof(us)); us.sun_family = AF_UNIX; strcpy((char *)&us.sun_path, sockname); - len = strlen(us.sun_path) + sizeof(us.sun_family) + 1; + us.sun_len = len = sizeof(us.sun_len) + sizeof(us.sun_family) + + strlen(us.sun_path) + 1; if (connect(ypsock, (struct sockaddr *)&us, len) == -1) { warn("failed to connect to server"); |