Re: [Exim] more 4.11 problems :-/

Pàgina inicial
Delete this message
Reply to this message
Autor: Kevin P. Fleming
Data:  
CC: Exim-users
Assumpte: Re: [Exim] more 4.11 problems :-/
Nico Erfurth wrote:

> On Fri, 13 Dec 2002, Rick Ennis wrote:
>
>
> >Philip,
> >
> >I think I found it. In "smtp_read_command()", smtp_in.c, line 440, your
> >
> >    if (!p->is_mail_cmd &&
> >        ++nonmail_command_count > smtp_accept_max_nonmail)

> >
> >the "++" is incrementing the variable before any of the 'if' is evaluated.
> >It's not conditionally incremented as intended. So something like...
> >
> >    if (!p->is_mail_cmd)
> >      if (++nonmail_command_count > smtp_accept_max_nonmail)

> >
> >probably ought to fix it.
>
>
> Very unlikely, the C-Compiler should generate code that does short
> evaluation. So the ++nonmail_command_count SHOULD be only triggered if
> !p->is_mail_cmd is set.
>

However (and I am not an expert here), combining pre/post-increment with other
operations is fraught with danger. Many C texts will tell you that the actual
sequence of events that will occur here is "undefined", meaning it's up to the
implementers of the compiler to decide which order things will happen. That may
be why this problem is occurring on some systems and not others.

With the single, combined condition, I can see valid reasons for the compiler to
implement it either way... But I don't have a C reference in front of me that
would codify exactly which is right (if either one is).