sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

commit b7c73e23929ca0aa68f48daf9f405fff7cce9fe7
parent f5baf2630ab0cf51306bb94311e7eed84caa730d
Author: Wolfgang Corcoran-Mathe <wcm@sigwinch.xyz>
Date:   Sun, 24 Jul 2016 21:04:28 -0400

ed: Fix backslash expressions in RHS

By stripping backslashes this code caused a number of bugs.
'\<digit>' expressions caused literal <digit>s to be subbed-in,
'\&' was treated identically to '&', and other escaped characters
added garbage to the string.

Diffstat:
Med.c | 7+------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git 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");