From corecode@corecode.ath.cx  Fri Mar 29 19:18:49 2002
Return-Path: <corecode@corecode.ath.cx>
Received: from mailout10.sul.t-online.com (mailout10.sul.t-online.com [194.25.134.21])
	by hub.freebsd.org (Postfix) with ESMTP id 4774937B405
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 29 Mar 2002 19:18:48 -0800 (PST)
Received: from fwd03.sul.t-online.de 
	by mailout10.sul.t-online.com with smtp 
	id 16r9OB-0004QK-01; Sat, 30 Mar 2002 04:18:47 +0100
Received: from spirit.zuhause.stoert.net (320050403952-0001@[217.82.55.8]) by fmrl03.sul.t-online.com
	with esmtp id 16r9Nw-183LUWC; Sat, 30 Mar 2002 04:18:32 +0100
Received: from elevation.zuhause.stoert.net (elevation.zuhause.stoert.net [192.168.66.46])
	by spirit.zuhause.stoert.net (8.11.6/8.11.6) with ESMTP id g2U3IVR52651
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 30 Mar 2002 04:18:31 +0100 (CET)
	(envelope-from corecode@corecode.ath.cx)
Received: (from corecode@localhost)
	by elevation.zuhause.stoert.net (8.11.6/8.11.6) id g2U3ITw38627;
	Sat, 30 Mar 2002 04:18:29 +0100 (CET)
	(envelope-from corecode)
Message-Id: <200203300318.g2U3ITw38627@elevation.zuhause.stoert.net>
Date: Sat, 30 Mar 2002 04:18:29 +0100 (CET)
From: "Simon 'corecode' Schubert" <corecode@corecode.ath.cx>
Reply-To: "Simon 'corecode' Schubert" <corecode@corecode.ath.cx>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: find segfaults when called without command in -exec
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         36521
>Category:       bin
>Synopsis:       find segfaults when called without command in -exec
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    jmallett
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 29 19:20:00 PST 2002
>Closed-Date:    Thu Apr 04 00:55:12 PST 2002
>Last-Modified:  Thu Apr 04 00:55:12 PST 2002
>Originator:     Simon 'corecode' Schubert
>Release:        FreeBSD 4.5-STABLE i386
>Organization:
>Environment:
System: FreeBSD elevation.zuhause.stoert.net 4.5-STABLE FreeBSD 4.5-STABLE #0: Fri Mar 22 19:08:08 CET 2002 corecode@elevation.zuhause.stoert.net:/usr/obj/i386/k7/usr/src/sys/ELEVATION i386


	
>Description:
	doing a find -exec ';' results in a segfault for each found file
	this is because this case isn't checked for and execvp gets a NULL parameter
	
>How-To-Repeat:
	find . -exec ';'
	# look at syslog
	
>Fix:
	maybe some kind of this:
	note! this patch was not checked, no guarantee this will compile, neither
	work! just to give the idea what is needed

--- /usr/src/usr.bin/find/function.c	Wed Oct  3 12:09:29 2001
+++ function.c	Sat Mar 30 04:12:56 2002
@@ -514,6 +514,9 @@
 			break;
 	}
 
+	if (ap == *argvp)
+		errx(1, "%s: no command given", option->name);
+
 	cnt = ap - *argvp + 1;
 	new->e_argv = (char **)emalloc((u_int)cnt * sizeof(char *));
 	new->e_orig = (char **)emalloc((u_int)cnt * sizeof(char *));
	


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->jmallett 
Responsible-Changed-By: jmallett 
Responsible-Changed-When: Mon Apr 1 22:10:48 PST 2002 
Responsible-Changed-Why:  
Over to me. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=36521 
State-Changed-From-To: open->patched 
State-Changed-By: jmallett 
State-Changed-When: Mon Apr 1 23:21:43 PST 2002 
State-Changed-Why:  
Committed to HEAD, thanks!  MFC in 3 days. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=36521 
State-Changed-From-To: patched->closed 
State-Changed-By: jmallett 
State-Changed-When: Thu Apr 4 00:54:33 PST 2002 
State-Changed-Why:  
Commited to -STABLE, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=36521 
>Unformatted:
