Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Mar 2002 04:18:29 +0100 (CET)
From:      "Simon 'corecode' Schubert" <corecode@corecode.ath.cx>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/36521: find segfaults when called without command in -exec
Message-ID:  <200203300318.g2U3ITw38627@elevation.zuhause.stoert.net>

next in thread | raw e-mail | index | archive | help

>Number:         36521
>Category:       bin
>Synopsis:       find segfaults when called without command in -exec
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 29 19:20:00 PST 2002
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200203300318.g2U3ITw38627>