From owner-cvs-all Sun Dec 3 18:38:24 2000 From owner-cvs-all@FreeBSD.ORG Sun Dec 3 18:38:22 2000 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from athserv.otenet.gr (athserv.otenet.gr [195.170.0.1]) by hub.freebsd.org (Postfix) with ESMTP id 36F6B37B400 for ; Sun, 3 Dec 2000 18:38:21 -0800 (PST) Received: from hades.hell.gr (patr530-b005.otenet.gr [195.167.121.133]) by athserv.otenet.gr (8.10.1/8.10.1) with ESMTP id eB42aJ502796 for ; Mon, 4 Dec 2000 04:36:20 +0200 (EET) Received: (from charon@localhost) by hades.hell.gr (8.11.1/8.11.1) id eB42Z3A16145 for cvs-all@FreeBSD.ORG; Mon, 4 Dec 2000 04:35:03 +0200 (EET) Date: Mon, 4 Dec 2000 04:35:03 +0200 (EET) From: Giorgos Keramidas Message-Id: <200012040235.eB42Z3A16145@hades.hell.gr> To: cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/lib/libc/gen setproctitle.c In-Reply-To: <200012040145.eB41jw809701@freefall.freebsd.org> Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG John Polstra wrote: > > Modified files: > lib/libc/gen setproctitle.c > Log: > When recording the original arguments, stop short if we encounter > a NULL argument. Some programs change the contents of the argv > array, typically to remove some special arguments. They shorten > argv by storing a NULL where an argument pointer used to be. Such > programs core dumped if they called setproctitle(), because it > would try to apply strlen() to a NULL pointer. What about avoiding parts of oargv[] in setproctitle() that are set to NULL by those programs? I haven't tested the following small patch to setproctitle.c, but I will test it tomorrow when I get to my development box at work. I am sending it anyway, since someone might have the time to check this by 09:00 EEST this morning. - giorgos Index: setproctitle.c =================================================================== RCS file: /home/ncvs/src/lib/libc/gen/setproctitle.c,v retrieving revision 1.12 diff -u -r1.12 setproctitle.c --- setproctitle.c 2000/08/01 06:37:09 1.12 +++ setproctitle.c 2000/12/04 02:31:33 @@ -129,6 +129,8 @@ len ? " " : "", oargv[nargc]); if (len) len++; + if (oargv[nargc] == NULL) /* avoid NULL pointers in oargv[] */ + continue; len += strlen(oargv[nargc]); if (len >= sizeof(obuf)) break; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message