aboutsummaryrefslogtreecommitdiffstats
path: root/re.c
diff options
context:
space:
mode:
Diffstat (limited to 're.c')
-rw-r--r--re.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/re.c b/re.c
index 1a0f0b182b..1f88d6053c 100644
--- a/re.c
+++ b/re.c
@@ -2298,9 +2298,10 @@ unescape_nonascii(const char *p, const char *end, rb_encoding *enc,
case 'M': /* \M-X, \M-\C-X, \M-\cX */
p = p-2;
if (enc == rb_usascii_encoding()) {
+ const char *pbeg = p;
c = read_escaped_byte(&p, end, err);
if (c == (char)-1) return -1;
- rb_str_buf_cat(buf, &c, 1);
+ rb_str_buf_cat(buf, pbeg, p-pbeg);
}
else {
if (unescape_escaped_nonascii(&p, end, enc, buf, encp, err) != 0)