Date: Sat, 12 Oct 2002 18:51:54 -0700 From: Terry Lambert <tlambert2@mindspring.com> To: Kris Kennaway <kris@obsecurity.org> Cc: current@FreeBSD.org, alfred@FreeBSD.org Subject: Re: rpcgen dumping core Message-ID: <3DA8D1BA.D440D106@mindspring.com> References: <20021012225839.GA96586@xor.obsecurity.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <bsd.prog.mk> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3DA8D1BA.D440D106>