From 3d3a92a528530a0d3774d34b47ca84e2794b99e5 Mon Sep 17 00:00:00 2001 From: dsl Date: Mon, 27 Aug 2007 19:51:50 +0000 Subject: [PATCH] This code has been broken for ~ 20 years! Initialise the 'fromlen' parameter for recvfrom() prior to the call, instead of passing in a 'random' value off the stack. This should fix the problems with ypbind on current. I suspect the old kernel was not objecting to -ve buffer lengths. --- usr.sbin/rpcbind/rpcb_svc_com.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.sbin/rpcbind/rpcb_svc_com.c b/usr.sbin/rpcbind/rpcb_svc_com.c index 097003f04142..07f98231c369 100644 --- a/usr.sbin/rpcbind/rpcb_svc_com.c +++ b/usr.sbin/rpcbind/rpcb_svc_com.c @@ -1,4 +1,4 @@ -/* $NetBSD: rpcb_svc_com.c,v 1.12 2007/05/16 14:42:07 christos Exp $ */ +/* $NetBSD: rpcb_svc_com.c,v 1.13 2007/08/27 19:51:50 dsl Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for @@ -1217,6 +1217,7 @@ handle_reply(int fd, SVCXPRT *xprt) goto done; do { + fromlen = sizeof ss; inlen = recvfrom(fd, buffer, RPC_BUF_MAX, 0, (struct sockaddr *)&ss, &fromlen); } while (inlen < 0 && errno == EINTR);