[hackers] [sbase] ed: Fix backslash expressions in RHS || Wolfgang Corcoran-Mathe

From: <git_AT_suckless.org>
Date: Tue, 27 Dec 2016 15:04:00 +0100 (CET)

commit b7c73e23929ca0aa68f48daf9f405fff7cce9fe7
Author: Wolfgang Corcoran-Mathe <wcm_AT_sigwinch.xyz>
AuthorDate: Sun Jul 24 21:04:28 2016 -0400
Commit: Laslo Hunhold <dev_AT_frign.de>
CommitDate: Tue Dec 27 12:29:52 2016 +0100

    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.

diff --git a/ed.c b/ed.c
index 0cf9fb9..582a5a2 100644
--- a/ed.c
+++ b/ed.c
_AT_@ -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");
Received on Tue Dec 27 2016 - 15:04:00 CET

This archive was generated by hypermail 2.3.0 : Tue Dec 27 2016 - 15:12:35 CET