aboutsummaryrefslogtreecommitdiffstats
path: root/driver.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1997-11-05 13:37:14 +0000
committerEric S. Raymond <esr@thyrsus.com>1997-11-05 13:37:14 +0000
commitf64438a8bdd145eb00502de34e396049d00d7dd5 (patch)
tree6f8bbdea32391beacff59698a9628ef84621dc15 /driver.c
parent8a66ad82d9f0a409bdac8ad7f8006294238ae052 (diff)
downloadfetchmail-f64438a8bdd145eb00502de34e396049d00d7dd5.tar.gz
fetchmail-f64438a8bdd145eb00502de34e396049d00d7dd5.tar.bz2
fetchmail-f64438a8bdd145eb00502de34e396049d00d7dd5.zip
Fix buglet in expansion of MDA %-escapes.
svn path=/trunk/; revision=1532
Diffstat (limited to 'driver.c')
-rw-r--r--driver.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/driver.c b/driver.c
index 0da54aae..f6fd799f 100644
--- a/driver.c
+++ b/driver.c
@@ -899,9 +899,16 @@ int num; /* index of message */
cp = (char *)NULL;
if (strstr(before, "%s") || (cp = strstr(before, "%T")))
{
+ char *sp;
+
if (cp && cp[1] == 'T')
cp[1] = 's';
+ /* \177 had better be out-of-band for MDA commands */
+ for (sp = before; *sp; sp++)
+ if (*sp == '%' && sp[1] != 's' && sp[1] != 'T')
+ *sp = '\177';
+
/*
* We go through this in order to be able to handle very
* long lists of users and (re)implement %s.
@@ -926,12 +933,22 @@ int num; /* index of message */
#endif /* SNPRINTF */
free(before);
before = after;
+
+ for (sp = before; *sp; sp++)
+ if (*sp == '\177')
+ *sp = '%';
}
/* substitute From address for %F */
if ((cp = strstr(before, "%F")))
{
char *from = nxtaddr(headers + from_offs);
+ char *sp;
+
+ /* \177 had better be out-of-band for MDA commands */
+ for (sp = before; *sp; sp++)
+ if (*sp == '%' && sp[1] != 'F')
+ *sp = '\177';
length += strlen(from);
after = alloca(length);
@@ -943,6 +960,10 @@ int num; /* index of message */
#endif /* SNPRINTF */
free(before);
before = after;
+
+ for (sp = before; *sp; sp++)
+ if (*sp == '\177')
+ *sp = '%';
}
if (outlevel == O_VERBOSE)