[En-Nut-Discussion] HTTP QueryString parser
Mikael Adolfsson
ma at stendahls.net
Sat Sep 13 09:59:38 CEST 2003
Lars,
I've found the bug.
The NutHttpProcessQueryString allocated too little memory.
At row 329 in httpd.c change from
req->req_qptrs = (char **)NutHeapAllocClear(sizeof(char
*)*req->req_numqptrs);
to
req->req_qptrs = (char **)NutHeapAllocClear(sizeof(char
*)*req->req_numqptrs*2);
(double the memory - ofcourse it needs space for a pointer to the param
name and one for the value.)
/ Mikael
On Fri, 12 Sep 2003, Lars Andersson wrote:
> Mikael,
>
> I use the same compiler version as you. The query string is also less
> than 256 chars.
>
> I tried to implement similar code to what I explained earlier into the
> httpd example that comes with the NUT/OS distribution. At first it
> seemed to work fine, but after a while I noticed that the system was
> very unstable. It seems that the connection is never closed.
>
> Could there be some memory leak?
>
> /Lars A Andersson
More information about the En-Nut-Discussion
mailing list