cvs commit: src/usr.sbin/sysinstall main.c

Andrey Chernov ache at freebsd.org
Mon Apr 30 16:40:35 UTC 2007


On Mon, Apr 30, 2007 at 12:29:20PM -0400, John Baldwin wrote:
> Have you coordinated at all with the guy on current@ who has patches to make 
> setenv(3) not leak memory as bad?  

No, I don't touch current allocation scheme at all. It isn't my goal.

> Also, given that we malloc a limited space 
> for the string values, I don't see how you can make it so that one can always 
> just overwrite the string pointed to by putenv(3)'s return value to change 
> the value.  If we malloc a buffer for length N and the user wants to set the 
> length to M > N, we pretty much have to malloc a new buffer that will end up 
> at a different address, so places holding onto the previous value returned 
> from putenv(3) will stop seeing updates.

It isn't the issue. Putenv value supposed to live just up to the next 
putenv or setenv call, so setenv can legitimately overwrite it.

-- 
http://ache.pp.ru/


More information about the cvs-src mailing list