[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] lagersegmentfejl coredumped ??





Hvis jeg har forstået alle svarne rigtigt, så er det alså fordi at
QUERY_STRING er tom når jeg kører lokalt og fuld når jeg kører fra web.

Alså er der faktisk ikke nogen problemer i det.....

Jan




Tjooo.....jeg er ikke helt sikker på om alle web servere håndterer query string éns, men hvis du ikke har parametre på URL'en til en Apache server, bliver QUERY_STRING til en NULL termineret tom streng.
Andre servere vil muligvis ikke initialisere QUERY_STRING, og så vil du stå med samme problem
I din kode antog du en del om formateringen af strengen, og det indbyder til buffer overflows.
Hvis du gør følgende


jann = getenv("QUERY_STRING");
if(jann != NULL)
{
   int len = strlen(jann);
   /* ... */
}

...så kan altid sørge for at holder dine indekseringer mindre en 'len'.
Personligt ville jeg nok bruge PHP i stedet for cgi i C, men hvis optimering var kritisk og C var eneste alternativ, ville jeg nok finde et cgi library på nettet. Jeg havde fat i ét engang, som kunne konvertere fra URL encodning og trække de enkelte variable ud af query strings. Det er en del nemmere.
Uden at vide meget om Perl, kan jeg sige, at det også er et bedre alternativ end C.


Robert

--
"I could use a heart. A human heart.
I need to pump a lot of blood out of my basement"
                                         - Bender





 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:09 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *