From b7c73e23929ca0aa68f48daf9f405fff7cce9fe7 Mon Sep 17 00:00:00 2001 From: Wolfgang Corcoran-Mathe Date: Sun, 24 Jul 2016 21:04:28 -0400 Subject: [PATCH] ed: Fix backslash expressions in RHS By stripping backslashes this code caused a number of bugs. '\' expressions caused literal s to be subbed-in, '\&' was treated identically to '&', and other escaped characters added garbage to the string. --- ed.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/ed.c b/ed.c index 0cf9fb9..582a5a2 100644 --- a/ed.c +++ b/ed.c @@ -900,13 +900,8 @@ getrhs(int delim) free(s); s = NULL; siz = cap = 0; - while ((c = input()) != '\n' && c != EOF && c != delim) { - if (c == '\\') { - if ((c = input()) == '&' || isdigit(c)) - s = addchar(c, s, &siz, &cap); - } + while ((c = input()) != '\n' && c != EOF && c != delim) s = addchar(c, s, &siz, &cap); - } s = addchar('\0', s, &siz, &cap); if (c == EOF) error("invalid pattern delimiter");