[En-Nut-Discussion] Bug #1799374: NutRegisterCgi() Parameter 1

Alain M. alainm at pobox.com
Tue Apr 1 18:51:04 CEST 2008


I don't understand something in what you say:
1) if you have a string that is NOT const and you pass it to a function 
that has a cont parameter, it is ok and no error messages
2) once a file is open, you will not use it's name anymore, so it can be 
discated anytime

Alain
BTW, the example bellow could crash because the second string is bigger 
than the first...


Nathan Moore escreveu:
> The point of this was that the strings that are passed aren't guaranteed to
> be constant or even there at all after the call to NutCgiRegister.
> They do tend to be constant and stay put wit normal use, but it's not
> guaranteed and won't work as expected if you do something like:
>    char foo[] = "web_page.cgi";
>    NutCgiRegister(foo, bar);
>    sprintf(foo, "I like kittens"); // <-- this is the silliness
> 
> If this silliness isn't done then you still have the issue that if the
> thread that registered the cgi pages exits you lose it's local variables so
> char foo[] above would go away.
> 
> 
> 
> 
> 
> On Tue, Apr 1, 2008 at 5:23 AM, Harald Kipp <harald.kipp at egnite.de> wrote:
> 
>> Hi,
>>
>> Can someone please confirm whether this is correct or not?
>> http://sourceforge.net/tracker/?group_id=34079
>>
>> IMHO, the string is never stored on the stack, but in the data segment.
>> But I'm not fully sure.
>>
>> Thanks,
>>
>> Harald
>>
>>
>> _______________________________________________
>> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>>
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
> 
> 



More information about the En-Nut-Discussion mailing list