From owner-freebsd-current Sat Oct 12 18:53:20 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 25B0A37B401; Sat, 12 Oct 2002 18:53:18 -0700 (PDT) Received: from falcon.mail.pas.earthlink.net (falcon.mail.pas.earthlink.net [207.217.120.74]) by mx1.FreeBSD.org (Postfix) with ESMTP id EFD9243EA3; Sat, 12 Oct 2002 18:53:16 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from pool0069.cvx21-bradley.dialup.earthlink.net ([209.179.192.69] helo=mindspring.com) by falcon.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 180XwQ-0004qG-00; Sat, 12 Oct 2002 18:53:14 -0700 Message-ID: <3DA8D1BA.D440D106@mindspring.com> Date: Sat, 12 Oct 2002 18:51:54 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Kris Kennaway Cc: current@FreeBSD.org, alfred@FreeBSD.org Subject: Re: rpcgen dumping core References: <20021012225839.GA96586@xor.obsecurity.org> Content-Type: multipart/mixed; boundary="------------81127F8A27DB3FB66F663A85" Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This is a multi-part message in MIME format. --------------81127F8A27DB3FB66F663A85 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Kris Kennaway wrote: > rpcgen -s `perl -e 'print "a"x5120'` > rpcgen -n `perl -e 'print "a"x5120'` > > will both segfault when you ^D them. This is because of the commit that Alfred made to invert the sense of the "-b" option to generate TIRPC output by default, instead. You can make the problem go away in -current by adding "-b", or you can make the problem show up in older versions of FreeBSD by adding the "-b" to get the TIRPC output, so technically, all he did was uncover an existing problem in a code path that was not normally used, which he then made the default. The problem only occurs when rpcgen'ing from stdin. Of course, making the problem "go away" gets you the wrong output code. Attached is a minimal diff that will fix the problem (which is basically everywhere infile is used without being cheched to see if it's non-NULL, as an argument to strrchr()). The fix works by substituting "" for NULL before this happens, but *after* the output file names have been created, to avoid creating files with a bogus prefix name. -- Terry --------------81127F8A27DB3FB66F663A85 Content-Type: text/plain; charset=us-ascii; name="rpcgen.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="rpcgen.diff" Index: Makefile =================================================================== RCS file: /cvs/src/usr.bin/rpcgen/Makefile,v retrieving revision 1.7 diff -c -r1.7 Makefile *** Makefile 14 Jul 2002 17:55:35 -0000 1.7 --- Makefile 12 Oct 2002 21:18:28 -0000 *************** *** 9,14 **** --- 9,15 ---- # This is a kludge to work around the fact that this program # uses 'inline' as a variable name. # + CFLAGS+=-g CFLAGS+=-Dinline=rpcgen_inline .include Index: rpc_svcout.c =================================================================== RCS file: /cvs/src/usr.bin/rpcgen/rpc_svcout.c,v retrieving revision 1.14 diff -c -r1.14 rpc_svcout.c *** rpc_svcout.c 21 Jul 2002 12:55:04 -0000 1.14 --- rpc_svcout.c 12 Oct 2002 21:47:39 -0000 *************** *** 107,112 **** --- 107,115 ---- int netflag; int nomain; { + if (!infile) + infile = ""; + if (inetdflag || pmflag) { char* var_type; var_type = (nomain? "extern" : "static"); --------------81127F8A27DB3FB66F663A85-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message