httpd: memory hole in function addEnv() and more
Dirk Clemens
develop at cle-mens.de
Mon Sep 5 09:30:16 UTC 2005
Vladimir N. Oleynik wrote:
> Dirk,
>
>>
>> 1.) memory hole
>>
>> Them memory alloced by asprintf() is never free'd.
>> Solution: insert free(s) behind putenv(s).
>
>
> No.
> man putenv()
> see libc incompatibility memory allocated sections.
Ok, it is a 'maybe' memory hole. With uclibc it is a memory hole.
We should use setenv() instead of putenv().
And if we use setenv() there is no need of using addEnv():
use
setenv("QUERY_STRING",config->query,1);
setenv("SERVER_SOFTWARE", httpdVersion,1);
instaead of
addEnv("QUERY_STRING", "", config->query);
addEnv("SERVER", "SOFTWARE", httpdVersion);
Dirk
More information about the busybox
mailing list