diff options
author | Paolo Bonzini <bonzini@gnu.org> | 2008-04-24 16:10:51 +0200 |
---|---|---|
committer | Paolo Bonzini <bonzini@gnu.org> | 2008-04-24 16:22:56 +0200 |
commit | f11ba2aec30bc8451c9b068d0a9b547439eab1ff (patch) | |
tree | 0957579fca8ba9f2ec0d9801eb5bb62e173961eb /sed | |
parent | 6b96a347ca463bb91d7b6144edc3cba245e10891 (diff) | |
download | sed-f11ba2aec30bc8451c9b068d0a9b547439eab1ff.tar.gz |
fix bug with \& in POSIX mode, reported by Samuel Colin
2008-04-24 Paolo Bonzini <bonzini@gnu.org>
* sed/compile.c (setup_replacement): Fix bug with \& in POSIX mode.
Diffstat (limited to 'sed')
-rw-r--r-- | sed/compile.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sed/compile.c b/sed/compile.c index f13cb14..95ed0aa 100644 --- a/sed/compile.c +++ b/sed/compile.c @@ -796,7 +796,16 @@ setup_replacement(sub, text, length) /* Skip the backslash and look for a numeric back-reference, or a case-munging escape if not in POSIX mode: */ ++p; - if (p < text_end && (posixicity != POSIXLY_BASIC || ISDIGIT (*p))) + if (p == text_end) + ++tail->prefix_length; + + else if (posixicity == POSIXLY_BASIC && !ISDIGIT (*p)) + { + p[-1] = *p; + ++tail->prefix_length; + } + + else switch (*p) { case '0': case '1': case '2': case '3': case '4': |