httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bojan Smojver <bo...@rexursive.com>
Subject Re: Bug in apreq_attr_to_type macro
Date Wed, 24 Sep 2003 00:00:25 GMT
Isn't that going to abort the program (i.e. Apache child process) for
P==NULL?

On Tue, 2003-09-23 at 22:19, Joe Schaefer wrote:
> Bojan Smojver <bojan@rexursive.com> writes:
> 
> > Quoting Joe Schaefer <joe+gmane@sunstarsys.com>:
> > 
> > > Thanks! I have a different take on the situation, though.
> > > IMO this represents a bug in apreq_cookie()- we *really should* 
> > > check the return value of apr_table_get before feeding it to the 
> > > macro.
> > 
> > I'm cool with whatever fixes the problem. Some other functions might
> > be suspect as well in this scenario. Basically, we'd need to make sure
> > NULL is never passed to this macro...
> 
> Yup, we sure do. How about adding an assert() to that effect?
> 
>   #define apreq_attr_to_type(T,A,P) ( assert(P != NULL), \
>                                      (T*) ((char*)(P)-offsetof(T,A)) )
> 
> I'm not sure that is a good idea, though, because this macro is 
> part of our public API, and this would add an <assert.h> dependence
> to it.  Any opinion?
-- 
Bojan


Mime
View raw message