Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Aug 1998 15:24:08 +0300 (EEST)
From:      Narvi <narvi@haldjas.folklore.ee>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        dg@root.com, freebsd@xaa.iae.nl, freebsd-current@FreeBSD.ORG
Subject:   Re: memory leaks in libc
Message-ID:  <Pine.BSF.3.96.980806152019.9173B-100000@haldjas.folklore.ee>
In-Reply-To: <199808061110.VAA13616@godzilla.zeta.org.au>

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

On Thu, 6 Aug 1998, Bruce Evans wrote:

> >   The problem with fixing setenv() is that you don't know if a pointer was
> >malloced, allocated from the env area above the stack, points to read-only
> >text, points to a static data buffer, etc. There really is no way to know
> >for sure, so you can't free the memory.
> 
> Yo can know if you malloced it in a previous call to putenv() or setenv().
> 
> Bruce

So we could:

	a) allocate a bit more memory than needed
	b) set the environment string
	c) end it with zero
	d) append a certain token after the end of the string saying "ok
	   to free() me" to anyone knowing what to look at?

But couldn't a string end at the end of allocated area so that by peeking
behind the final zero we will sometimes cause a SIGSEV?

	Sander

	There is no love, no good, no happiness and no future -
	all these are just illusions.



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?Pine.BSF.3.96.980806152019.9173B-100000>