Patch for 1.70

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: exim-users
Subject: Patch for 1.70
This is the first patch for 1.70. The "length" operator in string
expansions is completely broken; the entire substring is always
returned. As an alternative to installing this patch, convert any
expansions to use the "substr" operator instead. For example, change

${length_3:$local_part}

into

${substr_0_3:$local_part}

since the "substr" operator is not broken.     


-- 
Philip Hazel                   University Computing Service,
ph10@???             New Museums Site, Cambridge CB2 3QG,
P.Hazel@???          England.  Phone: +44 1223 334714




*** exim-1.70/src/expand.c  Thu Aug 21 15:49:02 1997
--- expand.c    Thu Aug 28 14:51:06 1997
***************
*** 1310,1326 ****
        int sign = 1;
        int len = -1;
        int offset = 0;
!       int *pn = (name[0] == 's') ? &offset : &len;
        int sublen = (int)strlen(sub);
        char *num = strchr(name, '_') + 1;


        /* First argument of substr may be negative */


!       if (*num == '-' && *name == 's')
          {
!         sign = -1;
!         num++;
          }


        while (*num != 0)
          {
--- 1310,1327 ----
        int sign = 1;
        int len = -1;
        int offset = 0;
!       int *pn;
        int sublen = (int)strlen(sub);
        char *num = strchr(name, '_') + 1;


        /* First argument of substr may be negative */


!       if (name[0] == 's')
          {
!         pn = &offset;
!         if (*num == '-') { sign = -1; num++; }
          }
+       else { pn = &len; len = 0; }


        while (*num != 0)
          {