SAILESH KRISHNAMURTI, BLOOMBERG/ 731 LEXIN wrote:
> I doubt about  strace for Solaris ;-) truss' me. 

Forgot about truss!  Thanks for the reminder, Ralf!

>                                                                               
>                                                         Hi, Forgive me if my 
> post dosent come out looking right, the mail client Im using is a bit 
> antiquated. However to answer the above questions, here is a code snippet 
> that illustrates how this is being set in the code:                 char 
> loc[2024];                                                                 
> sprintf (loc, "%s", location);//location is passed into the method            
>   apr_table_setn (r->headers_out, "Location", loc);
>  r->status = HTTP_TEMPORARY_REDIRECT;
>  return (HTTP_TEMPORARY_REDIRECT);                                            
>   The above is pretty standard. I also printed out the r->headers_out using 
> apr_table_getn and fprintf statements and it looks ok. the garbage characters 
> are the same for a given compilation attempt and apache instance but varies 
> between compilation attempts :-)                                             
>   

SAILESH : Adjust your sprintf to an snprintf line, and for the length,
use strlen(location);  For example :

sprintf (loc, "%s", location);//location is passed into the method

becomes :

sprintf (loc, strlen(location) "%s", location);//location is passed into
the method

char *loc;
loc = (char*)apr_palloc(r->pool,strlen(location));
strncpy(loc,location,strlen(location));
apr_table_setn (r->headers_out, "Location", loc);
r->status = HTTP_TEMPORARY_REDIRECT;
return (HTTP_TEMPORARY_REDIRECT);

And let us know if that behaves any differently.  (I believe that the
apr_table_setn actually sets the pointer, not copying the string, which
means the loc variable could be disappearing after leaving the function
and causing strange behavior.)

Joe
-- 
Joseph Lewis <http://sharktooth.org/>
"Divide the fire, and you will sooner put it out." - Publius Syrus

Reply via email to