httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Schaefer <joe+gm...@sunstarsys.com>
Subject Re: Bug in apreq_attr_to_type macro
Date Tue, 23 Sep 2003 12:19:17 GMT
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?

-- 
Joe Schaefer


Mime
View raw message