Re: [Exim] ACL problem when reading ACLs from files

Top Page
Delete this message
Reply to this message
Author: William Thompson
Date:  
To: Nico Erfurth
CC: Philip Hazel, exim-users
Subject: Re: [Exim] ACL problem when reading ACLs from files
> >If it's unacceptable, please let me know. The way I did it works, there's
> >just duplicated code.
> >
> >Here it is:
> >--- acl.c-orig    Mon May 12 09:39:17 2003
> >+++ acl.c    Tue May 20 10:37:27 2003
> >@@ -1274,13 +1274,35 @@
> > acl_getline(void)
> > {
> > uschar *yield;
> >+uschar *cont;
> > do
> >   {
> >   while (isspace(*acl_text)) acl_text++;
> >   if (*acl_text == 0) return NULL;
> >   yield = acl_text;
> >+  continuation_line:
> >   while (*acl_text != 0 && *acl_text != '\n') acl_text++;
> >-  if (*acl_text == '\n') *acl_text++ = 0;
> >+  if (*acl_text == '\n')
> >+    {
> >+    if (acl_text[-1] == '\\')

>
> Maybe I'm wrong, but wouldn't this access uninitialized memory (in worst
> case) when used on a empty line?


Yes, if the first line is blank. If it's not the first line and is blank,
it'll simply see the 0 that was put in place the last time it was called.
I suppose I can check to see if acl_text > yield first.

Like: if (acl_text > yield && acl_text[-1] == '\\')

I did try an acl with the first line blank. It didn't crash, however, if it
did happen to have a \ immediately at -1 in the file stream, cont is set
there and it would be modified.

Thanks for spotting that.