From f64438a8bdd145eb00502de34e396049d00d7dd5 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 5 Nov 1997 13:37:14 +0000 Subject: Fix buglet in expansion of MDA %-escapes. svn path=/trunk/; revision=1532 --- driver.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'driver.c') 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) -- cgit v1.2.3