summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2002-12-02 20:03:09 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2002-12-02 20:03:09 +0000
commit6a0ce95c473e6c24c804466ab05b41e8ef730937 (patch)
tree22728f747357897a4820faefcfa27a3d3e8c6487 /toke.c
parentc88449004825f6c7b2a3d6ce98c07515d2919b29 (diff)
downloadperl-6a0ce95c473e6c24c804466ab05b41e8ef730937.tar.gz
Fix bug #18573 : in a double-quoted string, a \c not followed
by any character may corrupt memory due to reading past the end of the input buffer. Add a new error message corresponding to this case. p4raw-id: //depot/perl@18233
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/toke.c b/toke.c
index 7d73497e79..722609b091 100644
--- 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 */