httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Jagielski <...@jaguNET.com>
Subject Re: I don't understand apr_array_push
Date Wed, 26 Jan 2011 16:49:06 GMT

On Jan 26, 2011, at 10:28 AM, Simone Caruso wrote:
> 
> Now i need to read the array (i read mod_alias.c):
>                for(k = 0; k < reqc->aliases->nelts ; k++){
>                        alias = (alias_t *)&reqc->aliases->elts[k];
>                        isalias = alias_matches(r->uri, alias->src);
>                        if(isalias > 0)
>                                break;
>                }
> 
> 

Do this:

    alias = (alias_t *)reqc->aliases->elts;
    for (k = 0; k < reqc->aliases->nelts ; k++, alias++){
        isalias = alias_matches(r->uri, alias->src);
        if(isalias > 0)
            break;
    }

> I don't understand why, when k=2, alias structure is filled with wrong addresses:
> 
> (gdb)
> 658                             isalias = alias_matches(r->uri, alias->src);
> (gdb)
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x00007fc350e6784f in alias_matches (uri=0x94f820 "/",
>    alias_fakename=0xda000000000094ff <Address 0xda000000000094ff out of bounds>)
> 
> 
> I tried a for like this without success (like mod_alias.c):
> for(k = 0; k < reqc->aliases->nelts -1 ; ++k){
> 
> 
> Any idea?
> thanks!
> 
> 
> -- 
> Simone Caruso
> IT Consultant
> +39 349 65 90 805
> p.iva: 03045250838
> 


Mime
View raw message