This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix bug #18573 : in a double-quoted string, a \c not followed
[perl5.git] / toke.c
diff --git a/toke.c b/toke.c
index 7d73497..722609b 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -1611,7 +1611,7 @@ S_scan_const(pTHX_ char *start)
            /* \c is a control character */
            case 'c':
                s++;
-               {
+               if (s < send) {
                    U8 c = *s++;
 #ifdef EBCDIC
                    if (isLOWER(c))
@@ -1619,6 +1619,9 @@ S_scan_const(pTHX_ char *start)
 #endif
                    *d++ = NATIVE_TO_NEED(has_utf8,toCTRL(c));
                }
+               else {
+                   yyerror("Missing control char name in \\c");
+               }
                continue;
 
            /* printf-style backslashes, formfeeds, newlines, etc */